vfwscanf() and friends

Hasso Tepper hasso at estpak.ee
Wed Apr 11 02:48:52 PDT 2007

I've found the problem that is probably a bug in libstdc++ headers,
but as other OSes seem to workaround it, I'm not sure how and where
we should fix it.

Small testcase (it's C++, fyi ;):

#define _POSIX_C_SOURCE 199309L
#include <cwchar>
int main() { return 0; }

It doesn't compile in DragonFlyBSD, but compiles in Linux and some
random BSD's I have here. Same problem appears with sources defining
_XOPEN_SOURCE 500 and including cwchar header. Both cases should be
perfectly legal AFAICS.

Looking at headers it seems to me that libstdc++ assumes that if
vfwscanf() and friends are in libc, they are there unconditionally
which isn't the case - they are visible in /usr/include/wchar.h if
source defines _POSIX_C_SOURCE at least 200112 (C99).

So, question - how to fix it and where? In libstdc++? But this will
still cause problems to anyone not using compiler provided by system.
In our /usr/include/wchar.h?


Hasso Tepper

More information about the Users mailing list