Ethereal-dev: Re: [Ethereal-dev] adding BASE_OCT?

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxx>
Date: Fri, 3 Nov 2000 19:06:11 -0800 (PST)
> It was actually already there, just didn't use the %o format - was lumped in
> with %d/%u for the int/uint. I made the change for the four places it did
> the format. It's not clear at this point if %o will work properly with a int
> as opposed to an unsigned int though.

Define "properly".  The ANSI C spec for "fprintf()" says

	o,u,x,X    The "unsigned int" argument is converted to unsigned
		   octal (o), unsigned decimal (u), or unsigned
		   hexadecimal notation (x or X) in the style "dddd";
		   ...

I.e., just as "%x" and "%X" will always print the number as if it were
unsigned, "%o" will always print the number as if it were signed.

If this is a problem, it's presumably not only a problem for octal, it's
presumably also a problem for hex.