From: Joe Buck <jbuck@synopsys.com>
To: egcs@cygnus.com
Subject: Re: Parsing of switch statement
Date: Wed, 10 Dec 1997 15:53:00 -0000 [thread overview]
Message-ID: <199712102344.PAA24001@atrus.synopsys.com> (raw)
In-Reply-To: <199712102001.PAA29621@erebus.phys.cwru.edu>
> Recently I have encountered some code that contains an empty case
> statement at the end of a switch (see example below).
Such code is neither legal C nor legal C++. I think it's an extension
to gcc; you shouldn't assume that all GNU C extensions will be available
in g++ (some clash with other C++ syntax, not sure about this one).
>
> Here is the simple test
>
> #include <stdio.h>
>
> int main (int argc, char *argv[])
> {
> int i=1;
> switch (i) {
> case 1 : printf ("1 ");
> case 0 : /* a ';' is needed here to compile with g++ */
> }
> printf ("\n");
> return 0;
> }
The ';' is needed with any C or C++ compiler other than gcc.
next prev parent reply other threads:[~1997-12-10 15:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-12-10 12:02 Craig J Copi
1997-12-10 15:53 ` Joe Buck [this message]
1997-12-11 5:32 ` Oleg Krivosheev
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=199712102344.PAA24001@atrus.synopsys.com \
--to=jbuck@synopsys.com \
--cc=egcs@cygnus.com \
/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).