On Tue, 2008-01-29 at 07:54 -0800, David Schwartz wrote: > > There is no "global" variable named errno, it only exist in the TLS. > You > > could say that because there is only 1 TLS, that it's global, and it > > acts that way. But it's not really the same as a normal global > > variable. You can't access the variables in the same manner you > access > > other global variables. > > Is the following code legal: > > 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' > } > > The answer is that if you're compiled single-threaded, it's perfectly legal. > If you're multi-threaded, it's not.
No, this is not legal code under the POSIX standard at all. -- Tomas Mraz No matter how far down the wrong road you've gone, turn back. Turkish proverb ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List openssl-dev@openssl.org Automated List Manager [EMAIL PROTECTED]