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: [PC] Simple AST Date: Fri, 08 Mar 2019 18:22:33 -0800 Organization: None to speak of Lines: 44 Message-ID: References: <28f4e80d-4ff5-44d3-bdec-eb593f551575@googlegroups.com> <86ef7kufly.fsf@mailhub.linuxsc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="27fa8bf6c916b83812acd4d11f7fc6c5"; logging-data="20523"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19xUZfSufSl9yTa0BSNTQqj" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:2MCIukzOF2X1t/evCZnrhjbosRA= sha1:NyyTiJTyr4zeFiKCu1oSEmtnFqo= Xref: csiph.com comp.lang.c:141829 "Pascal J. Bourguignon" writes: > James Kuyper writes: > >>> I have also tended to write things like "return(0);", even if >>> technically the parens are superfluous in this case. >> >> That makes a return statement look like a function-call statement. >> Because of the popularity of that style, I've known people who thought >> that it was a function. > > This shows that it is an advantage to adopt an homogenous syntax. I don't see how it shows that. > Note that we already have: > > if(…) > while(…) > do(…) > for(…) > > your_random_function(…) In each of those cases, the closing ")" is needed to mark the end of the condition. Some languages instead use a keyword (if condition then, while condition do, etc.) > so why not: > > return(…) Because the parentheses are unnecessary (the semicolon marks the end of the expression), and as others have said they make it look too much like a function call, *which it isn't*. (Personally, I always use a space in "if (condition)" and never in "func(params)"). [...] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */