From: Skip Tavakkolian <9nut@9netics.com>
To: 9fans@cse.psu.edu
Subject: [9fans] C99 and you
Date: Thu, 5 Oct 2006 11:32:15 -0700 [thread overview]
Message-ID: <5206ae35d06cc7d2086d65e1feec5265@9netics.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 456 bytes --]
somebody had a question a couple of days ago. i wonder if the declaration
was inside a switch or after a label?
in the example below, if the seemingly superfluous ';' (comments 1, and 2)
are removed, it is a syntax error. also note the scope of the declaration
inside a switch (e.g. when argc==1)
explanation: http://www.thescripts.com/forum/thread214730.html
reference: http://wwwold.dkuug.dk/jtc1/sc22/open/n2794/n2794.txt (look for A.2.3)
[-- Attachment #2: c99test.c --]
[-- Type: text/plain, Size: 315 bytes --]
#include <u.h>
#include <libc.h>
main(int argc, char **argv)
{
int i;
switch (argc) {
case 2:
; // 1
int j = 1;
print("argc = %d; j = %d\n", argc, j);
break;
case 1:
j = 0;
print("argc = %d; j = %d\n", argc, j);
break;
}
int k;
foo:
; // 2
int l;
exits(nil);
}
next reply other threads:[~2006-10-05 18:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-05 18:32 Skip Tavakkolian [this message]
2006-10-06 0:09 ` Bruce Ellis
2006-10-06 1:33 ` Skip Tavakkolian
2006-10-06 8:28 ` Charles Forsyth
2006-10-06 9:51 ` erik quanstrom
2006-10-06 16:00 ` Bruce Ellis
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=5206ae35d06cc7d2086d65e1feec5265@9netics.com \
--to=9nut@9netics.com \
--cc=9fans@cse.psu.edu \
/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 NNTP newsgroup(s).