Re: [AD] (v)sprintf vs (v)sNprintf

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> there is some mention in the src files that
> sprintf()  and vsprintf()  should use  vsNprintf()
>
> on win32 its _snprintf()  and _vsnprintf()
> i presume its the same minus the prefixed _ (underscore)  on *nix systems.
>
> is there any reason why its not done ?

Yes, DJGPP 2.03 (the current release) doesn't support them :-(

> can use  it with out the prefix for the src  and then just
> #define sprintf _sprintf
> for the win32 version.

Such defines are not very nice (although the Watcom port heavily uses them).
I would prefer that you put in all relevant places an explicit #ifdef

#ifdef HAVE_SNPRINTF
snprint(...)
#else
sprintf()
#endif

so that we can #define HAVE_SNPRINTF in the configuration header for each port 
that supports them.

And I think Win32 supports the non-underscored variants too, since they are 
defined by ISO C99.

-- 
Eric Botcazou



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/