Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: [ On topic, amazingtly ]: labels and declarations Date: Fri, 22 Mar 2019 11:13:56 -0700 Organization: None to speak of Lines: 33 Message-ID: References: <8gAjE.142392$tK1.4950@fx28.am4> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="7987eac78b6ba844db2ada674c778ee3"; logging-data="1145"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ME55fP2WvS4cxWI78Slvq" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:FqS4bNY4kMcaTz/sBxvg+gQO35c= sha1:UiuBsXrKYw8sqsXm454+HJIZw7s= Xref: csiph.com comp.lang.c:142251 Manfred writes: > On 3/22/2019 4:22 AM, Robert Wessel wrote: >>> This problem apparently follows from labels being neither statements nor >>> declarations, but instead entities of their own slapped into the >>> language to pair their ASM counterparts. >>> Today one may say they were not thought well enough in the beginning, >>> but considering the status of CS in the '70s it would have been probably >>> hard to foresee this kind of implications at the time, and hey, they >>> served the purpose so far. >> >> Labels are an optional prefix to a statement. > > i.e. a direct import from ASM, without further attempt for integration > with the language structure. Not really. The syntax and semantics of C's labels are similar to those of assembly language labels, but I'm not sure how else you'd define them. There's not much you could do to integrate them more closely into the rest of the language. Their syntax is defined using the same BNF as everything else: labeled-statement: identifier : statement case constant-expression : statement default : statement Compare that to the preprocessor, which really isn't tightly integrated into the language structure. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */