bug-gnulib
[Top][All Lists]
Advanced

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

Re: check for C99-compliant snprintf


From: Ben Pfaff
Subject: Re: check for C99-compliant snprintf
Date: Mon, 19 Feb 2007 15:53:10 -0800
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Albert Chin <address@hidden> writes:

> Huh? So, if vsnprintf() exists, you assume it's C99-compliant? glib
> has a check for this, AC_FUNC_VSNPRINTF_C99, because that's not the
> case on some systems. And, we found that Solaris and AIX 5.1 do not
> have a C99-compliant vsnprintf(). The attached program returns -1 on
> Solaris 6/SPARC thru Solaris 9/SPARC which has vsnprintf(), for
> example.

It's not hard to check at runtime whether [v]snprintf is
C99-compliant, as your example shows.  A previous version of my
proposed change did just that.  Paul Eggert requested that I try
to make it a compile- or link-time check, because the alternative
was to assume that [v]snprintf needed to be replaced if we were
cross-compiling.  I wasn't aware that these other systems have
non-compliant [v]snprintf, so I didn't check for them.

Is it better to try to enumerate non-compliant systems at
compile/link time, or to assume non-compliance when
cross-compiling?  Neither choice is ideal.  What's more likely to
be accepted into gnulib?
-- 
On Perl: "It's as if H.P. Lovecraft, returned from the dead and speaking by
seance to Larry Wall, designed a language both elegant and terrifying for his
Elder Things to write programs in, and forgot that the Shoggoths didn't turn
out quite so well in the long run." --Matt Olson





reply via email to

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