This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Strange pedantic error message


On 08-Feb-2001, James Montgomerie <jrmg@dcs.ed.ac.uk> wrote:
> When compiling with -pedantic (which I know I'm not supposed to do,

On the contrary, compiling with `-pedantic' is usually a good idea,
despite what the gcc documentation says.

> 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
> 
> I've done Google and Deja searches for the message, but can't find it.
> What does it mean?

It means that in a conditional expression `x ? y : z',
ANSI C does not allow just one of `x' and `y' to have type `void'.
They can both be `void', or they can both not be `void',
but if only one of them has type `void', that is not allowed.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]