
On 9/8/06, Jeff Garland <jeff@crystalclearsoftware.com> wrote:
[snipped]
There's something I want to clear out, lexical_cast is reentrant and only uses "stacked" variables no ?
So what? Those stack types are free to reference global data. And in the case of stringstream, in combination with operators<< and operator>>, they most certainly do access global data in the form of locales and facets.
But I believe almost every STL implementation has thread-safe iostreams, with locked access to global locales and etc. I know that VC 7.1 and STLPort has. Without it, it is almost impossible to write thread correct C++ programs. Or am I missing something?
[snipped]
The real problem here, is that lexical_cast *will work* most of the time in an MT environment without difficulty. But that's not good enough to declare it 'thread-safe'...which is the entire assumption in this thread. Actually, as this whole discussion illustrates, it's probably enough to make it 'thread-dangerous' ;-)
It is only thread-safe if what it uses has the basic thread-safety guarantees. Which, for all I know, it is true in every implementation that cares about writing thread-safe programs.
Jeff
best regards, -- Felipe Magno de Almeida