2007-07-14

Magic numbers in code

The following is from a piece of code which has fallen into my hands. It's from [a large military industry]. There's a new approach to the problem of magic numbers in code.

..
Byte_1_type vmu_ver_minor;
Byte_1_type spare_bytes[SIXTY_NINE];
U08Int_type checksum;

(Yes that's a #define to 69. Now you have all the means to make SIXTY_NINE be 17, like in fortran :)

LevR: "someone really hates numbers out there, I guess".

1 comment:

Artyom said...

This is a "really good programming style" :)