compiler can't tell int from function? nmh-1.0.4

Charles Swiger cswiger at mac.com
Fri Dec 23 10:04:57 PST 2005


On Dec 23, 2005, at 4:44 AM, Dieter wrote:
>> See errno(2), errno is redefined like this
>> #define errno           (* __error())
>> in /usr/include/errno.h
>
> Oh!  Someone changed errno from an int to a function, breaking massive
> amounts of code.  Bizzare.

See "man errno".  The notion that errno is an int works fine for  
single-threaded programs; but with multiple threads, you can have  
multiple system errors happening in parallel, which means you need a  
mechanism to identify and return the right one for each thread.

Note that you should not try to define external references to  
variables being provided to you via the standard includes yourself,  
because lots of them will do things like use functions or macros to  
inline references to the right code without exposing the inner  
workings to consumers of that API.

-- 
-Chuck



More information about the freebsd-ports mailing list