Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: question about linker Date: Wed, 11 Dec 2024 21:35:27 -0800 Organization: None to speak of Lines: 51 Message-ID: <878qslwjj4.fsf@nosuchdomain.example.com> References: <87ldwx10gv.fsf@bsb.me.uk> <86ser1kgp5.fsf@linuxsc.com> <87ldwtzlc0.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Thu, 12 Dec 2024 06:35:29 +0100 (CET) Injection-Info: dont-email.me; posting-host="fce124256618fa8243377af1ae3d31f3"; logging-data="2088155"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+N6rYQ1cmhezLjKjZtU78m" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:SerDBY98r65mdneKjYsOPOyI3lw= sha1:C3ia9CqX/TN7LBeTszZBZh+K5rA= Bytes: 3321 Janis Papanagnou writes: [...] > For (yet another) example; my K&R shows a syntax for expressions like > > expression := binary > binary := binary + binary > binary := binary * binary That's odd. Is that an exact quotation? > An actual expression x = 2 + 3 * 4 would be "ambiguous" (without > precedence rules). [...] My copy of K&R 1st edition (1978) has, among other things: multiplicative-expression: expression * expression expression / expression expression % expression additive-expression: expression + expression expression - expression That's ambiguous (presumably precedence is defined elsewhere). The second edition has something similar to what's in the C standard: multiplicative-expression: cast-expression multiplicative-expression * cast-expression multiplicative-expression / cast-expression multiplicative-expression % cast-expression additive-expression: multiplicative-expression additive-expression + multiplicative-expression additive-expression - multiplicative-expression Which means that the precedence is defined by the grammar -- but it also means that categories like "multiplicative-expression" and "additive-expression" are broader than one might naively expect. For example, 42 is both a multiplicative-expression and an additive-expression, even though it contains no multiplicative or additive operators. (Solving both issues would have required using even more convoluted names for the categories.) -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */