D - assert(Object)
Object o; assert(o); Instead of making sure "o" is a valid reference, it causes an access violation when trying to run its invariant. I think it should check for null first; it makes it easier, and would do what most newbies expect. -- Christopher E. Miller
Mar 17 2004
"Vathix" <vathix dprogramming.com> wrote in message news:c3a8eb$304f$1 digitaldaemon.com...Object o; assert(o); Instead of making sure "o" is a valid reference, it causes an access violation when trying to run its invariant. I think it should check for null first; it makes it easier, and would do what most newbies expect.An access violation is an exception, and if the invariant fails an exception is also thrown. All an access violation is is the hardware checking for the error rather than checking for it with software.
Mar 18 2004
Walter wrote:"Vathix" <vathix dprogramming.com> wrote in message news:c3a8eb$304f$1 digitaldaemon.com...I just mean it'd be nice if assert(o) translated into assert(o !== null && o.invariant()) instead of just assert(o.invariant()) so it works more like an if(o) statement. It's in debug mode so the extra check shouldn't be important. It's not a big deal, as I've gotten used to typing assert(o !== null); -- it's easier than running the program through the debugger. -- Christopher E. MillerObject o; assert(o); Instead of making sure "o" is a valid reference, it causes an access violation when trying to run its invariant. I think it should check for null first; it makes it easier, and would do what most newbies expect.An access violation is an exception, and if the invariant fails an exception is also thrown. All an access violation is is the hardware checking for the error rather than checking for it with software.
Mar 19 2004