Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Why does C allow structs to have a tag? Date: Wed, 09 Jun 2021 15:12:01 -0700 Organization: None to speak of Lines: 26 Message-ID: <87mtryofgu.fsf@nosuchdomain.example.com> References: <1bzgw0tpqu.fsf@pfeifferfamily.net> <45b9fa5f-d715-451c-b236-1a5d236614f7n@googlegroups.com> <20210609104104.187@kylheku.com> <0xawI.5$mGJ.2@fx08.ams4> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="980894617c75ccee08bd5def00aa42a4"; logging-data="17896"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LxJoG7OOaCcqRA0/+7QnY" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:ILRVRhmyuJ/K9VEhdZL0WtwDFpI= sha1:7skcgnJOXkCqgzWEiIP6k8/6Fks= Xref: csiph.com comp.lang.c:161345 Bart writes: > On 09/06/2021 18:48, Kaz Kylheku wrote: [...] >> In C, labels are visible function wide, whereas lexical scope follows >> blocks. So that alone calls for a separate namespace. > > It calls for different scoping rules. Labels are assigned to the > outermost block of a function. > > That's if you wanted similar behaviour with labels always having > function-wide scope. [...] Label names have function scope, not block scope. They're the only kind of identifier that has function scope. I suppose they could have been described as being scoped to the outermost block of the function (since goto statements and labeled statements can only appear within that block), but then you'd still have to describe the special rule that a label name is visible before the labeled statement that creates it. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */