public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Charconst valuation and short-circuiting
@ 2002-05-05 16:51 Neil Booth
  0 siblings, 0 replies; 3+ messages in thread
From: Neil Booth @ 2002-05-05 16:51 UTC (permalink / raw)
  To: gcc; +Cc: Joseph S. Myers

Should GCC not be attempting to value the character constant in
the following code (and therefore not give a hard error about
a too-long charconst?)

  if (0 && 'abcdefghijk')
   ...

Neil.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Charconst valuation and short-circuiting
  2002-05-06  4:07 Bonzini
@ 2002-05-06  4:29 ` Alexandre Oliva
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2002-05-06  4:29 UTC (permalink / raw)
  To: Bonzini; +Cc: gcc

On May  6, 2002, Bonzini <bonzini@gnu.org> wrote:

>> Should GCC not be attempting to value the character constant in
>> the following code (and therefore not give a hard error about
>> a too-long charconst?)

>> 
>> if (0 && 'abcdefghijk')

> I don't think so.

Agreed.  IMO, it's not too different from:

  if (0 && undefined_variable)

which is surely expected to trigger an error.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Charconst valuation and short-circuiting
@ 2002-05-06  4:07 Bonzini
  2002-05-06  4:29 ` Alexandre Oliva
  0 siblings, 1 reply; 3+ messages in thread
From: Bonzini @ 2002-05-06  4:07 UTC (permalink / raw)
  To: gcc

> Should GCC not be attempting to value the character constant in
> the following code (and therefore not give a hard error about
> a too-long charconst?)

> 
> if (0 && 'abcdefghijk')

I don't think so.  It is not unlikely to why you use if's instead
of #ifdef's so that dead code is eliminated but still flags errors.
If you wanted no errors, you'd use a preprocessor condition (I'm assuming
that 0 is valuable at compilation time, and hence at preprocessing time,
maybe with some help from autoconf a la SIZEOF_LONG).

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-05-06 11:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-05 16:51 Charconst valuation and short-circuiting Neil Booth
2002-05-06  4:07 Bonzini
2002-05-06  4:29 ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).