On 11:38, Bernhard R. Link wrote:
> * empty if or else branches
> as PRINT_DEBUG is sometimes empty, gcc warns about empty if and else
> braches. With some { } that stops (though other compilers might warn
> more). But I think this way it is "safest" to have no ugly effects
> (not that the danger was more than insignificant before)...
One common approach to deal with macros that might expand to nothing
is using constructs like
#define PRINT_DEBUG(foo) do { ... } while (0)
This avoids all warnings and works for all compilers. More importantly,
it catches the following class of bugs:
if (foo)
PRINT_DEBUG(...)
statement;
If PRINT_DEBUG(...) expands to nothing, the compiler will _not_
complain about the missing semicolon, and the code does _not_ do what
is suggested by the indentation.
Just my 2 cent.
Andre
--
The only person who always got his work done by Friday was Robinson Crusoe
signature.asc
Description: Digital signature
_______________________________________________ Ratpoison-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/ratpoison-devel
