[dmd-internals] Asserts

Sean Kelly sean at invisibleduck.org
Tue Nov 27 13:59:22 PST 2012


On Nov 11, 2012, at 11:50 AM, Walter Bright <walter at digitalmars.com> wrote:
> 
> I object to the following pattern:
> 
>     assert(p != NULL);
>     *p = ...;
> 
> i.e. dereferencing p shortly after checking it for null. This, to me, is utterly pointless in dmd. If, however,
> 
>    assert(p != NULL);
>    s->field = p;
> 
> and no dereference is done, then that has merit.

It may not be a big deal in DMD because it's historically been an app with one contributor.  But once multiple people are involved, well, I'm sure I don't have to sell you on contract programming since it's a feature in D.


More information about the dmd-internals mailing list