Path: csiph.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: "The long goodbye to C" by Eric Raymond Date: Sat, 18 Nov 2017 18:07:08 -0800 Organization: None to speak of Lines: 65 Message-ID: References: <4QePB.13018$bN1.2070@fx14.am4> <36hPB.16749$Jw1.11281@fx17.am4> <87tvxu18ff.fsf@bsb.me.uk> <87shddyc78.fsf@kst-u.example.com> <4ccde6fc-1ced-4182-b92d-202fdf9fa55c@googlegroups.com> <5a8ad8da-ed89-437f-bf55-a3d00e1f7be8@googlegroups.com> <676b4762-9066-4744-b9f3-80ec5b97e019@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="e8b9a44fd308b1a9775c10fc093f5a67"; logging-data="11829"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VFRIxyYOtzvbXi9b1Nj+2" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:BsQLyKSz76MxNeKQbdfP9ZZPHN4= sha1:rW37HGO2YsrkszRgKK2WQQXXvS8= Xref: csiph.com comp.lang.c:122965 bartc writes: > On 18/11/2017 20:53, Keith Thompson wrote: >> bartc writes: >> [...] >>> You can make a start by not allowing all those weird forms of >>> declaration. And not allowing, for example: >>> >>> int const const const typedef * x; >>> >>> (You won't see these extremes in real code, but because such variability >>> is allowed, if you see a construct you don't immediately grok, you have >>> to go through all the possibilities.) >> >> You want to make the language description more complicated, by >> adding more restrictions, to force code to be written more simply. > > It might be more complicated if the starting point has to be the current > grammar, because it is all over the place. But otherwise it would be > MUCH simpler. The starting point has to be the current grammar. Otherwise your simplifying changes will break existing code. In that case, you're talking about a new language, not C. [...] > How C end up with such a dog's dinner of a declaration syntax is a mystery. No, it's not a mystery. The history of the development of C is well documented. >> As for the "const const const", it's silly, and I can't think of >> a good reason to write it, but surely the meaning is clear enough. > > What was the reason for allowing it? You can't have more than one > typedef, nor more than one int (but you can have zero ints). It was probably easier to allow it than to forbid it. If you don't like it, don't write it. If you want to modify the language to forbid it, too bad. BTW, you can't have zero ints in that context. The original declaration was: int const const const typedef * x; Omit the "int" and it's illegal. >>> (int a, int b, int c) with (int a, b, c) >> >> That is at worst a minor inconvenience. > > Unnecessary repetition like this suggests room for improvement. (But my > suggestion can only be used when parameter names are used.) There's always room for improvement. (Let me remind you one more time: nobody claims C is perfect. Please stop claiming otherwise.) But language changes have a cost. Even backward compatible changes mean that new code written to depend on them can't be compiled with older compilers. In my opinion, "fixing" parameter declaration syntax would not be worthwhile. -- 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"