Article View: comp.std.c
Article #645Re: Declarations in switches, errors
From: Chris Torek
Date: Sun, 01 Oct 1989 05:32
Date: Sun, 01 Oct 1989 05:32
22 lines
1420 bytes
1420 bytes
In article <30540@news.Think.COM> barmar@kulla (Barry Margolin) writes:
>Here's something I think is closer to the original poster's complaint:
>why does the standard permit initializers in declarations at the head
>of a switch body, if they are required to be ignored?
It makes the language simpler conceptually: all variable declarations
are of the form
<type> <var> <optional initialiser> [, <var> <optional initialiser>]* ;
Even a compiler that is only 1/3 decent% will warn about unreachable
initialisers.
Note that the <optional initialiser>s are, as Doug has already pointed
out (it seems to require a great deal of repetition to get these to sink
in), treated as though they were executable statements when they apply
to automatic (as opposed to static or global) variables.
-----
% 1/3: `less than half'
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris@cs.umd.edu Path: uunet!mimsy!chris
Technical Details
Message-ID:
<19907@mimsy.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!purdue!haven!mimsy!chrisReferences:
<561@crdos1.crd.ge.COM> <11158@smoke.BRL.MIL> <637@crdos1.crd.ge.COM> <30540@news.Think.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!purdue!haven!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.std.c Subject: Re: Declarations in switches, errors Message-ID: <19907@mimsy.UUCP> Date: 1 Oct 89 05:32:51 GMT References: <561@crdos1.crd.ge.COM> <11158@smoke.BRL.MIL> <637@crdos1.crd.ge.COM> <30540@news.Think.COM> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 22