[Top][All Lists]

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

Re: check for C99-compliant snprintf

From: Eric Blake
Subject: Re: check for C99-compliant snprintf
Date: Tue, 20 Feb 2007 01:07:40 +0000

> > 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 would rather see the following: when not cross-compiling (or even
when cross-compiling, but the cross-executable can be run), use a
configure-time run check to decide up front whether the gnulib module
should even be used.  When cross-compiling, assume that the
gnulib module is required (but of course, this can be overridden
by presetting the appropriate cache variable to configure).  At
runtime, the gnulib module then performs a sanity check on first
usage; if it passes, then configure was pessimistic, and all further
*printf calls defer to the system (the cost is a slightly slower, slightly
larger executable); if it fails, then use the gnulib implementation.
That way, we can guarantee C99 semantics for all users,
regardless of whether cross-compiling was unable to detect

Eric Blake

reply via email to

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