>> void foo(void) >> { >> static int *my_errno=NULL; >> if(my_errno==NULL) my_errno=errno; >> // code that uses 'my_errno' as if it were 'errno' >> }
> No, this is not legal code under the POSIX standard at all. Since this code is single-threaded only, what POSIX standard are you talking about? The pthreads standard doesn't apply. In any event, provided the code is compiled single-threaded and thread-safety has not been asked for, it's a perfectly legal compiler optimization under the 'as-if' rule. No compliant code could ever tell the difference. Remember, I was not suggesting anyone actually write this code. I was suggesting it was a legal compiler optimization so long as the code was not compiled multi-threaded. My point is very similar, nothing requires the platform to generate thread-safe code if you don't ask it to. If it just happens to, it's purely by accident. DS ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List openssl-dev@openssl.org Automated List Manager [EMAIL PROTECTED]