🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4310

Re: Grammar for Switch Statement

#4310
From: Norman Diamond
Date: Wed, 01 Nov 1995 02:47
30 lines
1648 bytes
In article <4713rc$3d9@solutions.solon.com>, seebs@solutions.solon.com (Peter Seebach) writes:
>In article <470ih7$mvh@gaia.ns.utk.edu>,
>Eric Lemings <elemings@unix1.utm.edu> wrote:
>>Why is the grammar specification for a 'switch' statement:
>>    switch ( expression ) statement
>>instead of:
>>    switch ( expression ) block

>A block is a kind-of-a statement.

True, but this doesn't answer why they did it.

>But the key is that you do not need
>the {}'s if there is only one case and one statement.

True, but this doesn't answer why they did it.

>For instance: (One of my entries in IOCCC.)

Now we know why they did it.

Next question is why they require parentheses when return and sizeof don't
require parentheses around the expression.  Next, why did they spell out
the word in full, and why did they waste two keywords (swit and case) when
they could have done it in one.
--
 <<  If this were the company's opinion, I would not be allowed to post it.  >>
"I paid money for this car, I pay taxes for vehicle registration and a driver's
license, so I can drive in any lane I want, and no innocent victim gets to call
the cops just 'cause the lane's not goin' the same direction as me" - J Spammer
Technical Details
Message-ID: <476n45$8g0@jrdgwm.jrd.dec.com>
Path: arc1-ca.pugleaf.net!jrd.dec.com!diamond
References: <470ih7$mvh@gaia.ns.utk.edu> <4713rc$3d9@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!jrd.dec.com!diamond
From: diamond@jrd.dec.com (Norman Diamond)
Newsgroups: comp.std.c
Subject: Re: Grammar for Switch Statement
Date: 1 Nov 1995 02:47:33 GMT
Organization: DEC Japan Research and Development Center
Distribution: world
Message-ID: <476n45$8g0@jrdgwm.jrd.dec.com>
References: <470ih7$mvh@gaia.ns.utk.edu> <4713rc$3d9@solutions.solon.com>
NNTP-Posting-Host: jit533.jrd.dec.com