Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: double free Date: Fri, 02 Dec 2016 11:42:32 -0800 Organization: None to speak of Lines: 44 Message-ID: References: <87bn2317dl.fsf@bsb.me.uk> <87shvfyrq6.fsf@bsb.me.uk> <5c2dd4b1-c566-92a0-265c-7a7659e9bfeb@verizon.net> <47154296-b427-0c0e-7d73-fb3a1bbbd908@verizon.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="090cc7681cd75c4b27901d5937130ec3"; logging-data="2808"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+CzuOTm4g637G41EoxDmvQ" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:4A+F3wd7JZkIeAuPqrbRmePDkk8= sha1:5ZVlwjvJpAbCZeWpybPDVTWrc7o= Xref: csiph.com comp.lang.c:97896 "James R. Kuyper" writes: > On 12/02/2016 11:56 AM, Keith Thompson wrote: >> "James R. Kuyper" writes: > ... >>> True - if we're going to completely semantically distinguish all of the >>> different uses for parentheses in the C standard, the parentheses in >>> sizeof(int) (which are part of the sizeof syntax), should not only be >>> distinguished from the parentheses in puts("Hello, World!") (which are >>> part of the function call syntax), but also from the parentheses in >>> sizeof(a+b) (which are solely for grouping purposes). > > Just to be clear, I wasn't actually suggesting that this should be done, > only pointing out that it could be done. > >> In fact there are, if I've counted correctly, 24 distinct uses of >> parentheses in the grammar, any of which could in principle have >> been defined to use some other symbol. > > Agreed - with a couple of exceptions. C declarations ideally mirror one > valid way of using the declared identifier. Therefore, whichever symbols > are used to surround the arguments in a function call, should also be > used to declare that something is a function. This also applies to the > #definition and invocation of function-like macros. And, if we want to > retain the ability that currently exists to seamlessly replace a > function call with the invocation of a function-like macro, then > function calls and function-like macro invocations should also use the > same symbols to surround their arguments. Sure. A C-like language that used 24 distinct pairs of symbols (or keywords) in place of parentheses would be syntactically consistent, but very confusing. *Some* of those 24 usages are closely related to each other -- for example the two forms of compound literal, with and without a trailing comma. I have no particular problem with the fact that C uses parentheses for *all* 24 cases. I'm just pointing out that the use of the same symbol does not imply logical similarity, particularly for function calls vs. sizeof expressions. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"