max size for printf() format conversion?



Is there a clean, portable way to determine the maximum value of
converted numerical fields with printf()-like functions? Doing this
at compile-time would be preferable.

For example, %i should never convert to a string that is longer than
the number of digits in INT_MAX, right?

I'd like to create a structure that contains character
representations of numerical types (e.g., instead of storing 3421 as
an int, it would store the char array "3421"). I'd like to make
these fields a fixed-size static array, but obviously I don't want
to make them too small.

Thanks!
Matt

--
Matt Garman
email at: http://raw-sewage.net/index.php?file=email
.



Relevant Pages

  • Re: max size for printf() format conversion?
    ... > converted numerical fields with printf-like functions? ... > at compile-time would be preferable. ... > these fields a fixed-size static array, ... (both for signed and unsigned ints, you can drop the final "+ 1" for ...
    (comp.lang.c)
  • Re: max size for printf() format conversion?
    ... converted numerical fields with printf-like functions? ... such as some CRAY machines. ... I'd like to make these fields a fixed-size static array, but obviously I don't want to make them too small. ... You could write your own functions to do arithmetic on such strings, which would remove the limitation on their size. ...
    (comp.lang.c)
  • Re: max size for printf() format conversion?
    ... converted numerical fields with printf-like functions? ... %i should never convert to a string that is longer than ... I'd like to create a structure that contains character ... these fields a fixed-size static array, ...
    (comp.lang.c)
  • Re: max size for printf() format conversion?
    ... Matt Garman wrote: ... converted numerical fields with printf-like functions? ... %i should never convert to a string that is longer than ... are impossible to compute at compile time without ...
    (comp.lang.c)