fixing markdown tags

This commit is contained in:
Edson Brandi 2025-08-10 16:33:42 -03:00
parent 9e51e69092
commit c7be15f162

View file

@ -1228,10 +1228,10 @@ In the FreeBSD kernel, you'll often see this pattern inside macros designed to b
3. `do...while (0)`: Wraps the two statements so that when this macro is used, it behaves syntactically like a single statement, even if followed by a semicolon, preventing issues in constructs like: 3. `do...while (0)`: Wraps the two statements so that when this macro is used, it behaves syntactically like a single statement, even if followed by a semicolon, preventing issues in constructs like:
```c ```c
if (x) TIMESPEC_TO_TIMEVAL(tv, ts); if (x) TIMESPEC_TO_TIMEVAL(tv, ts);
else ... else ...
```
While `do...while (0)` may look odd, it’s a solid C idiom used to make macro expansions safe and predictable in all contexts (like inside conditional statements). It ensures that the entire macro behaves like one statement and avoids accidentally creating half-executed code. Understanding this helps you read and avoid subtle bugs in kernel code that rely heavily on macros for clarity and safety. While `do...while (0)` may look odd, it’s a solid C idiom used to make macro expansions safe and predictable in all contexts (like inside conditional statements). It ensures that the entire macro behaves like one statement and avoids accidentally creating half-executed code. Understanding this helps you read and avoid subtle bugs in kernel code that rely heavily on macros for clarity and safety.