[Qt-creator] Proposal: Adding std::(experimental::)optional

Christian Kandeler christian.kandeler at qt.io
Fri Aug 26 17:08:20 CEST 2016


On 08/26/2016 04:49 PM, charleyb123 . wrote:
> An aside:  We are currently steeped in the tradition that "zero" is not
> a legal address, but that is (quickly) becoming not-true for
> process-containers, system-emulators and VMs, and new hardware
> (including new CPUs). 

That has nothing to do with the null pointer in C(++). It never refers
to a valid address, that's how the language is defined. If zero is a
valid address in some environment, then it's the compiler's job to
ensure that the null pointer maps to something else at runtime.
That is also the reason that the following code is wrong:
    struct s { void *p; } s;
    memset(&s, 0, sizeof s); // s.p might not be a null pointer at runtime


Christian




More information about the Qt-creator mailing list