lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: remove top-level const's from declarations (issue 6501096)


From: David Kastrup
Subject: Re: remove top-level const's from declarations (issue 6501096)
Date: Fri, 07 Sep 2012 00:38:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

Graham Percival <address@hidden> writes:

> On Thu, Sep 06, 2012 at 07:20:57PM +0000, address@hidden wrote:
>> Description:
>> remove top-level const's from declarations
>
> Could you elaborate on why we want this?  Do the consts fail to
> compile with some compiler, or are they only supposed to be
> included in the C++ files, or...?

They are not part of the function signature.  It does not matter if they
differ between function declaration and function implementation.  In the
actual implementation, they tell the compiler that the variable assigned
with the parameter value is not supposed to be changed.  Since that
variable is not accessible after the function completes, this kind of
implementation detail is nonsensical to place in a header file, and
since it is not part of the function signature, the compiler does not
check for consistency.  It is just empty noise.

Note that it is noise for "top-level" const, like char * const x, but
not for things like char const *x where the const does not concern the
parameter itself but rather the data you can access _through_ it.

-- 
David Kastrup




reply via email to

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