Comment in #define's
Dolf Grunbauer
dolf at idca.tds.PHILIPS.nl
Tue Feb 5 18:42:23 AEST 1991
I've just had a (lint) problem. Somehow lint kept complaining about not
using a return value. It turned out that this was due to a comment in a
#define which was removed. I thought this was wrong, but now I am not so
sure anymore. The code looked like:
#define ERROR(x,v) if (x) {/*RVALUSED*/ send_answer(v); return}
void
somefunc(a,c) {
ERROR(a == 0, 1); /* 1 */
if (c) {/*RVALUSED*/ send_answer(2); return} /* 2 */
...
}
Statement 1 gave the error, while 2 was accepted without warnings. Now I am
wondering what should happen when the source file is run through only through
the preprocessor while the comments should stay in (flags: -E -Wp,-C): is
the comment in the #define supposed to be removed or not ? What does ANSI-C
say about this ?
BTW I solved the problem by using '(void)' in the define, so I don't need
any solutions to fix this particular problem :-)
--
_ _
/ U | Dolf Grunbauer Tel: +31 55 433233 Internet dolf at idca.tds.philips.nl
/__'< Philips Information Systems UUCP ...!mcsun!philapd!dolf
88 |_\ If you are granted one wish do you know what to wish for right now ?
More information about the Comp.lang.c
mailing list