emacs-devel
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]