const(Class) is mangled as Class const* const

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 27 13:14:54 PDT 2017


On 3/26/2017 3:29 PM, deadalnix wrote:
> 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.

Ironically, because C++ const is not transitive, most programmers use const in 
C++ as if it was transitive. This is most evident in templates where:

    const T

is used.


More information about the Digitalmars-d mailing list