[comp.lang.misc] Names for everything

sommar@enea.se (Erland Sommarskog) (01/13/91)

Also sprach Dr A. N. Walker (anw@maths.nott.ac.uk):
>Really?  Do you write
>
>	#define ONE	1
>       #define TWO	2
>       #define TWENTYFOUR	24
>       #define SIXTY	60
>       secs = (((days*TWENTYFOUR + hours)*SIXTY + minutes)*SIXTY + seconds;
>	for (j = ONE; ; j += TWO) ...;  /* step through odd integers */

Which reminds of how often I swore over my project colleagues
on my previous contract. Often you would find declarations like

CONST space = ' ';
      percent = '%';

which I usually removed and replaced every occurence of the constant
with the literal. The name of a constant should reflect the meaning
of the constant, not the contents. I don't know from where these 
people had acquired bad habits, but this an information-system place 
so Cobol inheritance is suspected.

However they are not alone. In "C++ primer", Stanley B. Lippman
has the following declaration on page 93:

  enum Vowels { a='a', e='e', i='i', o='o', u='u' };
-- 
Erland Sommarskog - ENEA Data, Stockholm - sommar@enea.se
"There is only one success -- to be able to spend your life in your own way"
Christopher Morely