yet another 4.2 bug

guy at rlgvax.UUCP guy at rlgvax.UUCP
Wed Dec 14 15:00:47 AEST 1983


While we're on the subject of %D, please note that System III and later
versions of UNIX do *NOT* support %D as a synonym for %ld.  More specifically,
%X doesn't mean %lx, it means "%x only put the hex digits 'a' through 'f'
out in upper case."  (This would have been useful for someone who complained
a few months ago that it was a pain to get "*printf" to produce output to
make his PROM burner, which expected upper-case hex, happy.)  Since "%ld"
will work on any reasonable (i.e., V6 with V7 Phototypesetter or later) UNIX,
but "%D" works on pre-S3 UNIXes, people should get in the habit of using "%ld"
rather than "%D" (it will also keep SCCS happier).

While you're all fixing your code, note that printing a long should *always*
be done with "%ld", not "%d", even though you "know" you're running on a machine
with 32-bit "int"s.  The next person that compiles your program may not be
running on such a machine...

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy



More information about the Comp.bugs.4bsd.ucb-fixes mailing list