const(Class) is mangled as Class const* const

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 27 14:32:56 PDT 2017


On Sunday, 26 March 2017 at 22:56:59 UTC, Jerry wrote:
> On Sunday, 26 March 2017 at 22:29:56 UTC, deadalnix wrote:
>> It is clear that you won't be able to express 100% of C++ in 
>> D, that would require to important all the weird parts of C++ 
>> into D, but if we are doing so, why use D in the first place ?
>>
>> Note that using const Class* in C++ is essentially useless. 
>> The class remains mutable and the reference is local the the 
>> callee anyway, so it doesn't change anything for the caller. 
>> Such a pattern is most likely indicative of a bug on the C++ 
>> side, or at least of code that do not do what the author 
>> intend to.
>
>
> For `const Class*` the Class is not mutable. It is the case of 
> `Class* const` that Class is mutable.

You are correct. See my first post for an explanation of this 
specific case.



More information about the Digitalmars-d mailing list