References in D

Walter Bright newshound2 at digitalmars.com
Sat Sep 15 14:30:18 PDT 2012


On 9/15/2012 5:39 AM, Henning Pohl wrote:
> The way D is dealing with classes reminds me of pointers because you can null
> them. C++'s references cannot (of course you can do some nasty casting).

Doing null references in C++ is simple:

int *p = NULL;
int& r = *p;

r = 3; // crash


More information about the Digitalmars-d mailing list