Variadic macros and commas

Ian Lance Taylor iant@google.com
Thu Mar 1 18:10:00 GMT 2007


David Sveningsson <ext@sidvind.com> writes:

> It keeps adding pointers until NULL is reached, thus the argument list
> must be ended with NULL. If 'first' is NULL an empty array is returned.
> However too often NULL is forgotten causing nasty bugs.

You may find the sentinel function attribute to be useful here.  It is
a gcc extension which adds a warnings if the function is called
without a trailing NULL.

Ian



More information about the Gcc-help mailing list