Elsewhere in Graphviz we sometimes need to print ints into fixed sized buffers,
but not using itos. So it is useful to have a value for the number of bytes this
requires that is also regularly validated by the Graphviz test suite. That is,
uses of this constant should be robust to future environment/platform changes,
because the itos tests will fail, prompting an update of this constant, that
will then correctly affect all usages of this.
#include <stdio.h>
+// maximum number of bytes needed to print a NUL-terminated int
+enum { CHARS_FOR_NUL_TERM_INT = 12 };
+
// return type of itos below
struct itos_ {
- char str[12];
+ char str[CHARS_FOR_NUL_TERM_INT];
};
/** convert an integer to a string