The docs on this are rather lacking so I'm hoping the community can run a simple test and post results here so that I, and anybody else, has a reference.
#include <cwchar>
sizeof( std::mbstate_t );
If you could post the results here and also mention which compiler you are using, I would be very grateful.
On VS2010 it's declared as typedef int mbstate_t;
and it's size is 4 bytes for both 32 and 64 bit builds.
I'm asking this because mbstate_t
is a member of streampos
. I need to use this member to store the conversion state of an encoding. The minimum space I can get away with is 3 bytes so I need to know if any implementation is going to break my code.
Thanks in advance.
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 on x86_64
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 on armv7l