Serious breakage of fstream(s) ?!?

Benjamin Kosnik
Fri Jan 18 22:57:00 GMT 2002

You're right. I broke ctype<char> for generic locale systems on linux, 
and probably solaris 2.8, which is (probably) the only other config using 
this type of lookup. It's broken for shared linkage only.

Sorry. That checkin was a total disaster. I only checked that the generic 
locale model compiled... busted. I'll be more careful in the future.

ctype<char>::classic_table() has to be static
-> the data member it returns must be static
-> _M_ctable -> _S_ctable

Initialization order of _S_ctable is undefined, thus the breakage, as 
it's zero instead of __ctype_b. Usually, src/ is used to skirt 
this issue using placement new, and then 
locale::classic() in src/ is hacked to get it right. However, 
this is not really an option this time around due to the config madness.

Here's a way to solve this, probably not super-cool but will do the job. 

1) add _M_ctable in as before, keep _S_ctable.

2) change to
ctype<char>::classic_table { _S_ctable = _M_ctable; return _S_ctable; }

There's probably a better way to do this but I'm tired.


More information about the Libstdc++ mailing list