Bad choice of preprocessor variable name

William LeFebvre phil at RICE.ARPA
Wed Jul 10 03:13:15 AEST 1985


I really like the idea of predefined preprocessor names that identify
the architecture/os of the host, such as:  sun, vax, vax11c, etc....
But I just ran into a major, major problem.  Whoever decided that these
names should be lower case should be shot!

Consider the 4.2 networking code.  The common name to use for a "struct
sockaddr_in" (a structure that defines an Internet domain socket) is
"sin".  Look at the 4.2 IPC Primer.  Now, consider what the common name
would be for a Unix domain socket, or, more specifically, a "struct
sockaddr_un".  You guessed it:  "sun".

Aww, geez.  Now who would be THAT stupid, hmmmm???  Look at the source
for the 4.2 line printer spooling software, specifically: "lpd.c" and
"startdaemon.c" (the latter is used by "lpc").  Guess what?!?  "struct
sockaddr_un sun;"  Now try compiling that on a Sun!  It don't work too
well.

Why not "Sun" and "Vax" (or, better yet, "VAX")?  What ever happened to
putting all preprocessor names in upper case?

			William LeFebvre
			Department of Computer Science
			Rice University
			<phil at Rice.arpa>
                        or, for the daring: <phil at Rice.edu>



More information about the Comp.unix.wizards mailing list