🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #936

Re: gcc 2.7.2 warning: left-hand operand of comma expression has no effect

#936
From: Bill McCarthy
Date: Fri, 08 Mar 1996 03:48
23 lines
1276 bytes
In <313DEA09.237C@tulsa.lgc.com>,
Glenn Carr <gcarr@tulsa.lgc.com> writes:

>We've just moved from gcc 2.6.3 to 2.7.2 and we're receiving the following new
>warnings (when -Wall is specified)....
>
>warning: left-hand operand of comma expression has no effect
>
>When this section of code is encountered in our source files...
>
>static char    *rcsid = "$Id: cfgopen.c,v 1.4 1995/12/11 16:04:35 gcarr Exp $";
>#if __GNUC__ == 2
>#define USE(var) static void * use_##var = (&use_##var, (void *) &var)
>USE(rcsid);
>#endif

Isn't comma in the #define is a comma operator?  Then you are taking the
address of use_rcsid and discarding it.  What will be returned to use_rcsid
is the address of rcsid (a char **) cast to a (void *).

Bill McCarthy
actuary@nando.net
Wendell, NC  USA
Technical Details
Message-ID: <4hoan9$eav@castle.nando.net>
Path: arc1-ca.pugleaf.net!castle.nando.net!news
References: <313DEA09.237C@tulsa.lgc.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!castle.nando.net!news
From: actuary@nando.net   (Bill McCarthy)
Newsgroups: gnu.gcc.help,comp.lang.c
Subject: Re: gcc 2.7.2 warning: left-hand operand of comma expression has no effect
Date: 8 Mar 1996 03:48:57 GMT
Organization: Nando.net Public Access
Message-ID: <4hoan9$eav@castle.nando.net>
References: <313DEA09.237C@tulsa.lgc.com>
Reply-To: actuary@nando.net (Bill McCarthy)
NNTP-Posting-Host: grail2314.nando.net
X-Newsreader: IBM NewsReader/2 v1.2