Empty loop elimination in 4.0 ?
Michael Veksler
VEKSLER@il.ibm.com
Mon Jan 10 16:55:00 GMT 2005
Neil Booth <neil@daikokuya.co.uk> wrote on 10/01/2005 16:59:56:
> Michael Veksler wrote:-
....
> > Another example, with C macros. I assume that with -DNDEBUG
> > assert(x) is empty:
> >
> > for (p: iterates over elements)
> > assert(p->value != NULL); /* Will warn with -DNDEBUG */
> >
> > /* Should I add "#ifndef NDEBUG" to protect the loop? */
>
> Any warning can be triggered by certain uses of macro expansions.
> That is not usually used as an argument to suppress them.
>
Your claim that "Any warning can be triggered by... macro..." should
not apply to a standard (as in ISO/ANSI) macro like assert. My example
is a reasonable use of assert. You don't want to uglify this code by an
"#ifndef NDEBUG" block, do you?
Also, most macros can be written in a way that does not produce
warnings. Not with this warning message.
More information about the Gcc
mailing list