From: Danny S. <dan...@cl...> - 2007-08-22 21:02:54
|
Keith Marshall Sent: Thursday, 23 August 2007 2:01 a.m. > > I'm not sure about this; I wonder if it may not be better to > remove the > existing implementations from libmingwex.a, so ensuring that there > really would be a link-time error, if [v]snprintf is used without > making any explicit behavioural choice. That way, any user who calls > [v]snprintf, expecting the old (broken) MSVCRT behaviour, would at > least be alerted to the issue, rather than maybe getting an > unpleasant > surprise later. One big problem with removing [v]snprintf definitions from libmingwex.a is that many configure scripts (indeed most GNU projects) check not only for prototype but also for a library definition. I would like to just alias the C99 standard names to the __mingw_[v]snprintf names in the library definition objects. That may surprise users who want non-C99 behaviour, but that doesn't bother me at all. It will bother people who see __mingw_[v]snprintf implementations as a performance penalty for float output. > > #ifdef __USE_MSVCRT_SNPRINTF > /* > * Use the MSVCRT implementations. > */ > # define snprintf _snprintf > # define vsnprintf _vsnprintf Yes. > > #else > /* > * Definitions to enable the MinGW enhanced [v]snprintf > implementation. This is the hard part. #defines are no good, since libstc++ headers will undef them. An always_inline definition is OK, but still needs a library definition for reasons stated above. The __asm__ redirection that I suggested earlier also has the problem of requiring a library definition (even a bogus one that just sets errno to ENOSYS would do) > */ > : > #endif > |