Thursday, February 19, 2004

Return of the Assertions

i was chatting with mohn , and we ended up discussing assertions again. the discussion ended with mohn suggesting disabling assertion at compile time.

i looked it up, and realised that it is not possible to disable assertions during compilation. (in java atleast). an example in javaworld, explains the point.

assertions were included in java 1.4. so all assert containing code is compiled with the flag -source 1.4 . suppose you do not include this option and try to compile code which contains the assert keyword,
Foo.java:5: warning: as of release 1.4, assert is a keyword, and may not be used as an identifier
is the error you'll get.

assert can be enabled/disabled during running code however, with the -ea , -da options.

how is it in .net ?

another question (probably the dumbest however) i had is whether FooBar is supposed ot mean anything. as i i have seen so many FooBar examples, i wonder if it was some historic programming whatever. u guys know what its supposed to signify or do i just need a break !!

No comments: