Acces Violation: assert with null instance

Sean Kelly sean at f4.ca
Fri Jan 26 08:36:18 PST 2007


Walter Bright wrote:
> Sean Kelly wrote:
>> Walter Bright wrote:
>>> It does check if it's null. That's how the access violation exception 
>>> gets thrown.
>>
>> But that's generated by the hardware, isn't it?
> 
> Yes.
> 
>> Shouldn't assert explicitly check whether c is null before calling its 
>> invariant?
> 
> Why, if the hardware does it for you (without extra bloat)?

Just so a file and line number are available.  Though someone mentioned 
the code already does something like "assert(obj); obj.invariant();" and 
the problem here was that it was a release build?  If this is the case 
I'm fine with the current behavior.  I really only care about this sort 
of thing if asserts are enabled.


Sean


More information about the Digitalmars-d-bugs mailing list