September 10, 2003 Re: DMD 0.68 bug: Assert on object references causing an exception. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | "Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:bi2ib7$3015$1@digitaldaemon.com... > Walter wrote: > > "Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:bh62vo$21bt$1@digitaldaemon.com... > > > >>In what way do you interpret the assert such that it would cause a hardware exception? The only way to cause a hardware exception is to dereference the null pointer (reference, sorry). Why would you do that in an assert? > > > > > > An assert on an object reference calls the invariant for that object. If the > > reference is null, it'll gp fault. > > Ok, that sounds reasonable. But is there any reason why it shouldn't check against null first? We are in debug mode, so performance isn't (as much of) an issue. Why bother if the hardware does it for you? |
Copyright © 1999-2021 by the D Language Foundation