if (1 == a) { ... }People give me a hard time for writing code this way, but there's a very good reason to do it like this instead of a == 1 . Slip up and type a single equals and my code becomes invalid (in just about any language), slip up the other way and you have the perfectly valid but wrong a = 1 . So I had to smile today when the compiler complained to me:
Hadn't made this mistake in several years, but a few seconds later the problem was corrected. Somewhere else someone is cursing their program and it may be some time before they find the problem.g++ -g -Iinc -Wno-multichar -D_DEBUG -D_LINUX -o obj/snp_core.o -c snp_core.cpp snp_core.cpp: In function `int main(int, char**)': snp_core.cpp:43: non-lvalue in assignment make: *** [obj/snp_core.o] Error 1
Feb '04
Oops I dropped by satellite.
New Jets create excitement in the air.
The audience is not listening.
Mar '04
Neat chemicals you don't want to mess with.
The Lack of Practise Effect
Apr '04
Scramjets take to the air
Doing dangerous things in the fire.
The Real Way to get a job
May '04
Checking out cool tools (with the kids)
A master geek (Ink Tank flashback)
How to play with your kids