[Top][All Lists]

[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 16:47:47 -0800
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Albert Chin <address@hidden> writes:

> On Mon, Feb 19, 2007 at 03:53:10PM -0800, Ben Pfaff wrote:
>> 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?
> How about assuming compliance when cross-compliance but enumerate,
> when cross-compiling, the systems that fail? When not cross-compiling,
> let's perform the compile-time check.

I'm willing to fix my proposed change so that it does this.

It appears, based on online documentation, that snprintf is C99
compliant in AIX 5.2 and above.  Is that correct?  If so, then
will the following successfully detect the systems with broken
        #if defined _AIX && !defined _AIX52
        /* broken */

How do you test for Solaris 6 through 9?  The list at
predef.sf.net is not very helpful on this, because it doesn't
give any hint how to test for a range of Solaris versions, only
for particular versions.
Ben Pfaff 

reply via email to

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