Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Jan 2010 20:50:34 -0800
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        freebsd-standards@freebsd.org
Subject:   wchar_t in inttypes.h and C++
Message-ID:  <eaa228be1001232050s69306a17t614448e3e2cb2a33@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hey folks,

The handling of wchar_t in inttypes.h for wcsto*max(3) is currently
broken in C++ where wchar_t is a built-in type and not derived from
__wchar_t.  I have a patch to define wchar_t if it isn't defined in C
and to use wchar_t in the declarations rather than __wchar_t as we do
today, as is done in other headers that declare wchar_t functions.
BDE doesn't like it -- certainly it's unclear that it would be okay
for inttypes.h to define wchar_t in C -- but I'm not sure there's a
markedly-better alternative.

We could define a type ___wchar_t (or something like) that is a
typedef of __wchar_t in C and a typedef of wchar_t in C++.  We could
define wcsto*max(3) differently for C++ and C.  We could declare the
functions as taking wchar_t but only define them if wchar_t has been
defined (or we're compiling for C++).

For the sake of argument, here's the inttypes.h patch that follows the
lead of stdlib.h:

http://people.freebsd.org/~jmallett/wchar-inttypes.diff

Thanks,
Juli.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?eaa228be1001232050s69306a17t614448e3e2cb2a33>