🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #644

Re: Declarations in switches, errors

#644
From: Doug Gwyn
Date: Sun, 01 Oct 1989 00:25
18 lines
1308 bytes
In article <30540@news.Think.COM> barmar@kulla (Barry Margolin) writes:
>Well, since the initial value of automatic variables is undefined, a
>conforming implementation COULD execute them.

NO, not in general.  (The only time it could occur is if it would
have no observable effect!  What would be the point of that?)

>why does the standard permit initializers in declarations at the head
>of a switch body, if they are required to be ignored?

Because it's attempting to standardize C, not some vaguely similar
language.

The initializer IS NOT REQUIRED TO BE IGNORED.  It is treated
EXACTLY like any other auto initializer.  Static initializers
in a switch body are also treated like any other static initializers.

You guys have the wrong mental model of C initialization!
Technical Details
Message-ID: <11202@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!ginosko!uakari.primate.wisc.edu!uflorida!haven!adm!smoke!gwyn
References: <561@crdos1.crd.ge.COM> <11158@smoke.BRL.MIL> <637@crdos1.crd.ge.COM> <1989Sep30.052000.13719@utzoo.uucp> <30540@news.Think.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!attcan!uunet!ginosko!uakari.primate.wisc.edu!uflorida!haven!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: Declarations in switches, errors
Message-ID: <11202@smoke.BRL.MIL>
Date: 1 Oct 89 00:25:47 GMT
References: <561@crdos1.crd.ge.COM> <11158@smoke.BRL.MIL> <637@crdos1.crd.ge.COM> <1989Sep30.052000.13719@utzoo.uucp> <30540@news.Think.COM>
Reply-To: gwyn@brl.arpa (Doug Gwyn)
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 18