version and debug statements

Anders F Björklund afb at algonet.se
Thu May 11 13:24:18 PDT 2006


Walter Bright wrote:

>> It does... I was just hoping to be able to use the same code for both ?
> 
> I know it seems like the right thing to do to use the same code for both 
> operating systems. I'm going to argue that this is a case where 
> copy/paste might be better. Operating systems change all the time, but 
> developers rarely test on all supported systems.

I should mention here that std.c.unix.unix is being *autogenerated*...

module std.c.unix.unix;

/* This module imports the unix module for the currect
    target system.  Currently, all targets can be
    handled with the autoconf'd version. */

import gcc.configunix;

That is, all the values for the different constants and such are being
provided by GNU Autotools, for the current operating system / platform.

There is one such for each target, in my case "powerpc-apple-darwin7",
just as there is one compiler for each target (for cross-compilation)

> So if there's common OS 
> code, chances are good that improving support for, say, linux, will 
> break existing support for, say, bsdunix. If the two are in separate 
> source trees, the linux expert can keep the linux stuff maintained 
> without worrying about breaking bsdunix, about which he may know nothing.

Oh, version(linux) is NOT going away. If it is needed, you can still
write special code for specific operating systems. But for 90% of the 
time, the same code can be used for all these "Unix-like" systems...

But if I understand you correctly, it is *better* to do an "assert(0);"
on those other systems than to try the generic code and hope it works ?
I must say I prefer autotools then, even if they have their wrinkles.

If have to patch it manually anyway, "darwin" or "Unix" doesn't matter.

--anders


PS. See "autobook" for autotools info
     http://sourceware.org/autobook/



More information about the Digitalmars-d mailing list