This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Strange pedantic error message
- To: 'James Montgomerie' <jrmg at dcs dot ed dot ac dot uk>, gcc at gcc dot gnu dot org
- Subject: RE: Strange pedantic error message
- From: David Korn <dkorn at pixelpower dot com>
- Date: Thu, 8 Feb 2001 11:40:51 -0000
>-----Original Message-----
>From: James Montgomerie [mailto:jrmg@dcs.ed.ac.uk]
>Sent: 08 February 2001 10:37
>When compiling with -pedantic (which I know I'm not supposed to do, I just
>thought it would be interesting - I don't usually use it), I often get
>the following warning:
>
>warning: ANSI C forbids conditional expr with only one void side
If I understand it correctly, what this means is that you have an instance
of the ternary operator
x = (test) ? (expr1) : (expr2);
and the types of expr1 and expr2 don't match; specifically, one of them is
void (non-value returning) and the other one isn't. This is a problem
because it means that depending on the test, the overall expression either
returns a value and has a type or it doesn't.
You shouldn't be getting this with a simple if .. else.
DaveK
--
we are not seats or eyeballs or end users or consumers.
we are human beings - and our reach exceeds your grasp.
deal with it. - cluetrain.org
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************