Edmund Grimley Evans wrote:
> I don't think you are allowed to assume that mbstate_t is a structure
> and has members, so memset is definitely better.
Well, that's my point: according to
<http://www.dinkumware.com/htm_cl/wchar.html#mbrtowc> you *are* allowed to
make this assumption. It explicitly says that mbstate_t "is an object type
o-type", i.e. a "struct" or an "union" (or a "class", if in C++). It also
implicitly says that the 1st member of this object must be an integral type
(and, if in C++, that it is must be a public property).
An applicative programmer of a implementation doesn't need to care much
about this: she can simply follow Markus' bulletproof suggestion to use
"memset()".
But, if Plauger is right, an implementer of the library *must* define
mbstate_t as a struct (or union or class), even if, say, her implementation
would only need a single integer to represent an MB state. The reason is
that she must support applicative code that contains (ugly) declarations
"mbstate_t mbst = {0};".
_ Marco
-
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/linux-utf8/