Why version() ?
Anders F Björklund
afb at algonet.se
Wed Feb 11 03:02:20 PST 2009
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 ?
> 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.
> This would be even better if the OSX and linux declarations were split
> into separate "personality" modules. That way you can develop happily on
> OSX without fear of accidentally breaking linux support. You can defer
> dealing with the linux version until you actually on the linux machine
> and are in an efficient position to take care of it.
The version(linux) and version(darwin) should keep those separated,
right ? And save you when you include the wrong std.c module, too...
--anders
More information about the Digitalmars-d
mailing list