Struct with default ctor (Was: [dmd-beta] dmd 2.064 beta take 2)
Jonathan M Davis
jmdavisProg at gmx.com
Sat May 18 21:42:42 PDT 2013
On Saturday, May 18, 2013 21:30:57 Walter Bright wrote:
> On 5/18/2013 9:06 PM, Jonathan M Davis wrote:
> > The closest that there is is
> > C++'s references, which aren't rebindable and in many ways act more like
> > aliases than pointers.
>
> You can trivially create null references in C++:
>
> int* p = NULL;
> int& r = *p;
Yes, but they're designed with the idea that they're non-nullable. You can't
assign NULL to them or check if they're NULL. It's just that it's possible to
make them NULL by the trick that you just showed. Really, it's an example of
how C++ references are more like aliases than pointers (much as they're
pointers underneath the hood). All around, they're a bad example of a non-
nullable pointer even though that's kind of what they're supposed to be in
principle.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list