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

Tobias Hunger tobias.hunger at gmail.com
Fri Aug 26 17:54:49 CEST 2016


On Fri, Aug 26, 2016 at 5:08 PM, Christian Kandeler
<christian.kandeler at qt.io> wrote:
> 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.

0 is a valid address. The OS usually makes sure the first page is not
mapped, thus triggering a segfault if you try to dereference 0 (or in
fact the first 4k or so, depending on page size).

Linux had a security issue once where an attacker could map code into
the 0-page, triggering that code by accessing a
null-(function-)pointer.

> 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.

I highly doubt that: 0 is a valid address, so the compiler can not
just go ahead and map it elsewhere as it pleases.

Best Regards,
Tobias



More information about the Qt-creator mailing list