Struct with default ctor (Was: [dmd-beta] dmd 2.064 beta take 2)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun May 19 14:36:17 PDT 2013


On 5/19/13 4:30 PM, Peter Alexander wrote:
> On Sunday, 19 May 2013 at 20:03:24 UTC, Andrei Alexandrescu wrote:
>> You are blowing it out of proportion. Null references are hardly even
>> on the radar of the bug classes I'm encountering in the style of
>> programming of the three groups I worked in at Facebook, and also my
>> previous employers. People I meet at conferences and consulting gigs
>> never mention null references as a real problem, although I very often
>> ask about problems. I find it difficult to agree with you just to be
>> nice.
>
> Just because people don't mention them as a problem doesn't mean it
> isn't a problem.
>
> For what it's worth, null pointers are a real problem in the code I work
> on (games). I don't know exactly what you work on, but I find that they
> are more of a problem in highly stateful, interactive applications.
> Things like generic libraries, utility programs, compilers, etc.
> probably won't see the same problems because they aren't very stateful
> or interactive.
>
> In my experience, null pointers are easy to fix, but the risk of them
> causes people to litter their code with if (ptr) tests, often with poor
> handling of the failure case, which can cause subtle bugs (no crash, but
> unintended code path).
>
> Just my 2c.

OK, this is sensible. One question - would you be willing to type 
symbols as NullType!T instead of T to avoid these issues?

Thanks,

Andrei


More information about the Digitalmars-d mailing list