[Top][All Lists]

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

Re: check for C99-compliant snprintf

From: Albert Chin
Subject: Re: check for C99-compliant snprintf
Date: Mon, 19 Feb 2007 18:01:00 -0600
User-agent: Mutt/1.5.6i

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.

albert chin (address@hidden)

reply via email to

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