Liste des Groupes | Revenir à cl c |
David Brown <david.brown@hesbynett.no> writes:The second example was from the footnote in the C standard's section on <errno.h>, so it can't be /that/ bad!
[...]The normal way for multi-threaded systems is to implement it as aBoth of those need more parentheses -- and I'm unconfortable using the
macro. It might be, for example :
>
#define errno __thread_data->_errno
>
or
>
#define errno *errno()
same identifier for the macro and the function.
That is precisely why it is specified in the C standards as a macro,[...]
not an external linkage object with static or thread-local storage
duration. (The use of errno in multi-threading C code long predates
C11 and _Thread_local.)
glibc and musl both have :
# define errno (*__errno_location ())
newlib (used on Cygwin) has something similar :
#define errno (*__errno())
Les messages affichés proviennent d'usenet.