rich@rexago1.UUCP (K. Richard Magill) (01/29/86)
This is on a 3b2/300 Sv.2.2. At a guess, lint doesn't parse much but instead does lots of lexxing. So, how do I write this so that lint doesn't complain? Can I do it without writing a function Q()? #define Q() ((void)f(),g()) /* this is actually in a library header file */ main() { (void) Q(); return(0); } /* main */ f() { /* these too are in the library */ return(0); } /* f */ g() { return(-1); } /* g */ x.c ============== function returns value which is always ignored g K. Richard Magill ...decvax!cwruecmp!rexago1!rich "I'm not crazy! I just don't give a f^K
throopw@dg_rtp.UUCP (02/03/86)
> At a guess, lint doesn't parse much but instead does lots of lexxing.
Say what? The lint utility must parse just as much as a compiler... in
just what sense does a typechecker parse "less" than it lexes?
In any event, this is indeed a bug in lint (or so I assert). The
expression ((void)f(),(void)g()) provokes no message, but
(void)((void)f(),g()) causes a warning about the value of g being
ignored. Clearly, g's value is explicitly being ignored in both cases.
In general, lint's opinions about side effects, lack thereof, and what
constitutes "use" of a value are less useful then they ought to be.
Unfortunately, the upshot for your case seems to be that there isn't a
clean way to get lint to accept your construct.
--
Wayne Throop at Data General, RTP, NC
<the-known-world>!mcnc!rti-sel!dg_rtp!throopw