[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs rewrite in a maintainable language
From: |
David Kastrup |
Subject: |
Re: Emacs rewrite in a maintainable language |
Date: |
Tue, 13 Oct 2015 16:30:35 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
John Yates <address@hidden> writes:
> On Tue, Oct 13, 2015 at 8:22 AM, Mathieu Lirzin <address@hidden>
> wrote:
>
>> Oleh Krehel <address@hidden> writes:
>>
>> > For exactly this reason (the confusion over 3 notations, 2 of which are
>> > the same), I propose that we stick only to "const char *" and "char *
>> const",
>> > and don't use "char const *".
>>
>> This seems a good idea to me. It would be nice for this convention to
>> be documented somewhere. I think this can be defined in GNU coding
>> standards. Can you send this suggestion to address@hidden
>>
>
> Standardizing is a good thing. Basing the choice purely on subjective
> preference is less so. Many who have looked at the C and C++ grammars
> notice that
>
> const char *
>
> is an historical irregularity that has been folded into the grammar as
> a special case. Embracing and standardizing on that special case
> detracts from learning a consistent rule and typically leads to
> misreading of more complex declarators. The alternative is to leverage
> the fact that a const or volatile qualifier always applies to the
> object to its left so cv-qualifiers uniformly appear on the right. No
> need to remember special case rules or the relative precedence of
> various type constructs. Many C++ well-regarded coding standards
> have adopted such a rule (along with moving '*' and '&' leftward).
I don't get the preoccupation with the order and the talk about
"historical irregularity". I can perfectly well write
unsigned const int extern x;
and that is a well-formed declaration. It doesn't matter in which order
the various type declarators appear: you can reorder at will as long as
you don't move across * or equivalent.
I am not even sure _historically_ (meaning K&R C), storage class
specifiers would have had to come before the rest. After all,
extern x;
was and still is a perfectly valid declaration in C, so a storage class
declaration can fill in for a type declaration.
--
David Kastrup
- Re: Emacs rewrite in a maintainable language, (continued)
- Re: Emacs rewrite in a maintainable language, Artur Malabarba, 2015/10/13
- Re: Emacs rewrite in a maintainable language, David Kastrup, 2015/10/13
- Re: Emacs rewrite in a maintainable language, Oleh Krehel, 2015/10/13
- Re: Emacs rewrite in a maintainable language, David Kastrup, 2015/10/13
- Re: Emacs rewrite in a maintainable language, Eli Zaretskii, 2015/10/15
- Re: Emacs rewrite in a maintainable language, David Kastrup, 2015/10/13
- Re: Emacs rewrite in a maintainable language, Alan Mackenzie, 2015/10/15
- Re: Emacs rewrite in a maintainable language, Mathieu Lirzin, 2015/10/15
- Re: Emacs rewrite in a maintainable language, John Yates, 2015/10/13
- Re: Emacs rewrite in a maintainable language, Oleh Krehel, 2015/10/13
- Re: Emacs rewrite in a maintainable language,
David Kastrup <=
- Re: Emacs rewrite in a maintainable language, Andreas Schwab, 2015/10/13
- Re: Emacs rewrite in a maintainable language, John Wiegley, 2015/10/15
- Re: Emacs rewrite in a maintainable language, Paul Eggert, 2015/10/13
- Re: Emacs rewrite in a maintainable language, Oleh Krehel, 2015/10/13
- Re: Emacs rewrite in a maintainable language, Andy Moreton, 2015/10/13
- Re: Emacs rewrite in a maintainable language, Przemysław Wojnowski, 2015/10/14
- Re: Emacs rewrite in a maintainable language, Tassilo Horn, 2015/10/14
- Re: Emacs rewrite in a maintainable language, Przemysław Wojnowski, 2015/10/14
- Re: Emacs rewrite in a maintainable language, Oleh Krehel, 2015/10/14
- Re: Emacs rewrite in a maintainable language, Tassilo Horn, 2015/10/14