Bill Sommerfeld <[EMAIL PROTECTED]> wrote:
> ...
> The problem lies in the guts of the PUTD() macro, which
> contain the following code fragment:
>
> c = 10;
> while (c <= i)
> c *= 10;
>
> The repeated "c *= 10" done here will overflow a 32-bit signed integer
> when i is greater than 1 billion, resulting in mangled output.
>
> The crude, but effective, hack above extends the range of "c" so that
> it doesn't overflow in this case -- however, not all platforms may
> support the int64_t type yet.
What about just using 'unsigned int' instead of 'int64_t'?
> It might make more sense, however, to rework the macros to use
> sprintf() or snprintf() instead.
Well...yeah...but you still have to worry about cross-platform support
(unless we have our own snprintf() in nmh).
[EMAIL PROTECTED]