Subroutine layout in C

Dave Jones djones at megatest.UUCP
Sat Jan 7 11:00:36 AEST 1989


>From article <18789 at agate.BERKELEY.EDU>, by bowles at eris.berkeley.edu (Jeff A. Bowles):

> Some people use:
> 	typedef enum {true = 1, false = 0} boolean;
> and when you're able to use this single line, and later say "if (true)..."
> I'll probably use this - it DOES make things clearer.

I can't agree. I know of one _extremely_ large project where several
programmers have defined "YES" and "NO" and "TRUE" and "FLASE".
So you get "redefined" messages if you need to include header
files from two different packages.  To make things worse,
one programmer who was unfamiliar with C conventions defined
"YES" as 0 and "NO" as 1.  Gack.  His header files will break
all the other ones.  That sort of proves that an SLM was out of place:
It has to mean what it means. If you change the #define, you change
the logic and break the program.

I've noticed that some released Sun software gets "redefined" messages.
In one header file there is something like this:

    #define true (0==0)

and in another

    #define true (0!=1)

or something like that.

Pooh.



More information about the Comp.lang.c mailing list