The do { } while(0) construct in C macros

The do { } while(0) construct in C macros is used to ensure that the macro behaves like a single statement, allowing it to be safely used in conditional statements without causing syntax errors. This approach helps avoid issues with semicolons and braces, making the macro more versatile and reliable in various coding styles.

Example

#define ASSERT(_condition) do { if (!(_condition)) { FATAL_ERROR("Violated assert: " #_condition); } } while (0)

More describe in: https://pyjamabrah.com/posts/do-while-magic/