lmi
[Top][All Lists]
Advanced

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

Re: [lmi] [lmi-commits] master 9cc3f6b 05/10: Avoid passing an enum by r


From: Greg Chicares
Subject: Re: [lmi] [lmi-commits] master 9cc3f6b 05/10: Avoid passing an enum by reference
Date: Thu, 8 Feb 2018 15:26:07 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 2018-02-08 13:50, Vadim Zeitlin wrote:
> On Thu,  8 Feb 2018 08:40:09 -0500 (EST) Greg Chicares <address@hidden> wrote:
> 
> GC> branch: master
> GC> commit 9cc3f6bde87bb01fb31f1f75a224b13bdab1d008
[...]
> GC>     Removed '&' from a function's enum arguments...leaving 'const' because
> GC>     the arguments must not be changed and it isn't too weird to say so.
[...]
>  In fact I think it is too weird to say so

Okay, I'll remove 'const' from the changed lines.

> because (as you certainly know)
> this top level "const" is simply ignored in C++ and so the function
> definition could still declare these parameters without "const" and modify
> them if it so wished.

I had never thought of it that way. Assuming, arguendo, that this
'const' is desirable in the definition, I would tend to write it
in the declaration as well. Two principles conflict:

 - declarations should match definitions textually

 - declarations with meaningless qualifiers should not be written

and you give good reason to favor the second of those two.

I'd never considered that question because it has probably never
come up previously--because this 'const' is, well, weird.



reply via email to

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