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: Fri, 16 Feb 2007 07:23:50 -0800
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Paul Eggert <address@hidden> writes:

> It's a bit of a pain that this will reject all cross-compiled snprintfs.
> Is there some way you can test for this at compile-time?
>
> Does the nonstandard snprintf have exactly the same signature as the
> C99 snprintf?  If not, we should be able to catch this at
> compile-time.
>
> Does the nonstandard implementation have a vsnprintf?  If not, we
> could test for that at link-time and cross-compiles wouldn't have to
> substitute snprintf except on clearly pre-C99 systems.
>
> Basically, I'm looking for any way we can distinguish the nonstandard
> implementation without running it.

I agree that it would be nicer to distinguish the non-C99
snprintf at compile time.  Unfortunately, the noncompliant
snprintf has exactly the same signature and return value, and the
system also has vsnprintf.

We could of course test whether the system is Windows, using
  #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
or similar.  Is that a better idea?
-- 
Ben Pfaff 
address@hidden
http://benpfaff.org





reply via email to

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