#define cpLog (priority__, fmt__, args__...)

Implement cpLog as a macro only if we are using the GNU C compiler, i

Documentation

Implement cpLog as a macro only if we are using the GNU C compiler, i.e. if __GNUC__ is defined. The GNU C compiler defines __FILE__ and __LINE__ preprocessor macros that we can use to tell cpLog_impl_ exactly where the calling code is located, allowing for easier debugging. @doc This idiom ensures that certain macro expansions work by wrapping the if statement into a single block. Without the do-while "armor", the macro would cause syntax errors inside a one-statement block without brackets (e.g. the body of a while loop or of an if statement). The naive and more readable solution of placing brackets around this macro's expansion also would not work, because 'cpLog;' would expand to include a semicolon after the brackets, which constitutes illegal syntax. Hence the do-while idiom is the right solution.

alphabetic index hierarchy of classes


generated by doc++