This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What is errno really defined as


>> Errno is declared as a function returning pointer to int and it does not
>> modify or read any golbal variables.
> 
> The way errno is defined actually makes it quite easy to read and write it
> from the application.
> 
> If you wrote:
> 
> errno = 0;
> 
> It would translate to:
> 
> (* __errno_location ()) = 0;
> 
> i.e. get the address of errno, then write 0 at that address.

[Then the light bulb appeared] Ah! I've nerver seen, or read anybody doing anything like that before in my life, and I've read at least 7 books on C.
This is really cool, but tells me nothing about the volitle or non-volitle state of errno. As for thread local storage, I'll have to read up on that.

Thanks, that is very interesting and worth while thing to know.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]