public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Schirmer, Hartmut" <SchirmerH@Innovative-Systems.de>
To: "'Joerg Faschingbauer'" <jfasch@aon.at>
Cc: "'gcc@gcc.gnu.org'" <gcc@gcc.gnu.org>
Subject: RE: enumeration value ... not handled in switch
Date: Wed, 26 Sep 2001 09:03:00 -0000	[thread overview]
Message-ID: <1F5C7ECB324CD411B58600D0B723F181779422@oehhex01.becker.de> (raw)

Hi,

> This is bug #3780. I'll be cleaning up my patch a bit (although it
> won't become less dirty by doing so :-) and submit it. (This won't
> happen before two weeks, though.)

not really the same problem.

In my C code (not C++) I have

enum { A, B, C } x;

switch (x)
{
case A:
case B:
case C:
   break;
default:
   // strange
   abort();
}

The default case is for runtime safty. The variable x may be in an
illegal state (not initialized, corupted, ...)

If I later add a D to the enum I won't get a warning because of
the default case. Changing the code to

switch (x)
{
case A:
case B:
case C:
   break;
default attribute(silent):
   // strange
   abort();
}

enables the compile time analysis so I don't have to wait for
a runtime error.

Hartmut

             reply	other threads:[~2001-09-26  9:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-26  9:03 Schirmer, Hartmut [this message]
2001-09-26 10:55 ` Joerg Faschingbauer
  -- strict thread matches above, loose matches on Subject: below --
2001-09-24  1:04 Schirmer, Hartmut
2001-09-26  6:27 ` Joerg Faschingbauer
2005-01-11  6:08 ` Daniel Brockman
2005-01-11  8:20   ` Daniel Brockman
2005-01-11 14:28 ` hartmut.schirmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1F5C7ECB324CD411B58600D0B723F181779422@oehhex01.becker.de \
    --to=schirmerh@innovative-systems.de \
    --cc=gcc@gcc.gnu.org \
    --cc=jfasch@aon.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).