This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: , operand with no effect warning
- To: 'Joern Rennecke' <amylaar at redhat dot com>, drow at mvista dot com
- Subject: RE: , operand with no effect warning
- From: Bernard Dautrevaux <Dautrevaux at microprocess dot com>
- Date: Tue, 31 Jul 2001 12:08:52 +0200
- Cc: pedwards at disaster dot jaj dot com, moz at compsoc dot man dot ac dot uk, gcc at gcc dot gnu dot org
> -----Original Message-----
> From: Joern Rennecke [mailto:amylaar@redhat.com]
> Sent: Tuesday, July 31, 2001 4:33 AM
> To: drow@mvista.com
> Cc: pedwards@disaster.jaj.com; moz@compsoc.man.ac.uk; gcc@gcc.gnu.org
> Subject: Re: , operand with no effect warning
>
>
> > > > delete p1, p2;
> > >
> > > Because this does have an effect.
> >
> > Admittedly, the whole statement has an effect - p1 is
> deleted. But the
>
> No, p2.
>
WRONG; the comma operator is the lowest precedence operator of the whole
expression syntax; it is even lower than asignment, so that
a = 0, b = 1
is a legal expression doing what you expect. So
delete p1, p2
means really
((delete p1), (p2))
Thus p1 is deleted, and p2 is returned as value of the expression.
That is probably why there is no warning: GCC must have noticed that delete
was called and, having a return type of void, has no result. It may forgot
to reset that flag at the comma operator... However, as I had not looked at
the code, this "explanation" is quite surely plain wrong :-)
Best regards
Bernard
--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel: +33 (0) 1 47 68 80 80
Fax: +33 (0) 1 47 88 97 85
e-mail: dautrevaux@microprocess.com
b.dautrevaux@usa.net
--------------------------------------------