On Mon, Feb 19, 2007 at 04:47:47PM -0800, Ben Pfaff wrote: > Albert Chin <[EMAIL PROTECTED]> writes: > > > On Mon, Feb 19, 2007 at 03:53:10PM -0800, Ben Pfaff wrote: > >> Albert Chin <[EMAIL PROTECTED]> 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?
Correct. > If so, then will the following successfully detect the systems with > broken snprintf: > #if defined _AIX && !defined _AIX52 > /* broken */ > #endif > > 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. I doubt anyone is cross-compiling on Solaris or AIX so I just wouldn't worry about the cross-compiler case for them. -- albert chin ([EMAIL PROTECTED])
