On 5/27/21 1:46 PM, Eric Blake wrote:

Yet another portable solution is:

static mbstate_t s1;
mbstate_t s = s1;

also with its own form of ugliness.

I did that years ago, but compilers complained about it when I made s1 'const', and I vaguely recall complaints even when it wasn't 'const' ("What? You're declaring a static variable that is always zero and never changes? That must be a bug!!").

At this point I wouldn't worry about the older clang and gcc versions that complain about {0} as an initializer. We can either let them die off noisily, or use the appropriate -Wno-whatever option when using them to compile.

Reply via email to