From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <5206ae35d06cc7d2086d65e1feec5265@9netics.com> To: 9fans@cse.psu.edu Date: Thu, 5 Oct 2006 11:32:15 -0700 From: Skip Tavakkolian <9nut@9netics.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-gjkwojperbnlwvqwigscbyzncv" Subject: [9fans] C99 and you Topicbox-Message-UUID: c54edb22-ead1-11e9-9d60-3106f5b1d025 This is a multi-part message in MIME format. --upas-gjkwojperbnlwvqwigscbyzncv Content-Disposition: ainline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit 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) --upas-gjkwojperbnlwvqwigscbyzncv Content-Disposition: attachment; filename=c99test.c Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit #include #include 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); } --upas-gjkwojperbnlwvqwigscbyzncv--