[net.unix-wizards] More on debug statements

richl (03/31/83)

Regarding chuqui at mit-mc's suggestion on debug statements, you must
keep in mind one thing: on vaxen arguments default to int which happens
to be 32 bits. Everybody is happy. However, do the same thing on a 11/70
or smaller and watch what happens when you do something like

	debug(stdout,"value of l is %ld, value of k is %d\n",l,k);

where l is long and k is int. "l" may get written correctly; I can
guarantee that k will not. The arguments of the function debug, of course,
have defaulted to *16* bits. To make it even harder to debug, the reverse
will work:

	debug(stdout,"value of k is %d, value of l is %ld\n",k,l);

because the value of l will overlap with an argument you don't use. This
can give you fits; because I used a similar debug in moving a vax
program to an 11/70 and spent a great deal of time tracking down non-existent
bugs (due to my improper use of the debug statement) than I did working on
real bugs due to the machine differences.


Rick Lindsley
richl@tektronix
...ucbvax!tektronix!richl