bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib and *printf


From: Joel E. Denny
Subject: gnulib and *printf
Date: Wed, 7 Oct 2009 19:25:15 -0400 (EDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

Hi.

I have a couple of questions about gnulib's support for the printf family.

1. Is the snprintf-posix module helpful in order to use the following 
portably?

  length = snprintf (NULL, 0, format, args);
  str = malloc (length + 1);
  snprintf (str, length + 1, format, args);

The snprintf man page warns of portability problems for the first snprintf 
invocation above, but snprintf-posix appears to test only vsnprintf's 
functionality for this purpose by invoking gl_VSNPRINTF_ZEROSIZE_C99.  Am 
I misunderstanding the module?  Is it assuming snprintf and vsnprintf will 
always manage to behave consistently in this respect?

2. Is there any single module that ensures portability of all *printf 
functions?  Or is it worthwhile to maintain a list of modules trimmed to 
exactly the functions that are currently used?

Thanks.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]