Why version() ?

Walter Bright newshound1 at digitalmars.com
Wed Feb 11 12:01:14 PST 2009


Anders F Björklund wrote:
> Walter Bright wrote:
> 
>> Now let's try the other way. I add O_APPEND to the linux branch, and 
>> linux works great. Now I port to OSX, and the compiler dies with 
>> "O_APPEND is undefined". I know immediately exactly what is wrong, 
>> look up the .h file, and insert the right O_APPEND into the OSX 
>> version of the declaration.
> 
> Maybe I'm missing something here, but why is Mac OS X including
> std.c.linux.linux ? Shouldn't it use std.c.darwin.darwin instead ?

You're not missing anything. This needs to be cleaned up. (BTW, it will 
be osx, not darwin, as "darwin" seems to be only used in internal Apple 
documentation, whereas the published stuff says "OSX".)


>> Furthermore, when I build a FreeBSD version, the compiler bings at me 
>> for every declaration that needs some porting attention, instead of 
>> silently using the wrong values.
> 
> GDC got tired of porting std.c.linux.linux over, so it generates a
> std.c.unix.unix module from the C headers at configure time instead.
> 
> Also helps with the constants that have different values for different
> architectures, in addition to having different values for different OS.

Doing it automatically is better, of course.




More information about the Digitalmars-d mailing list