version and debug statements

Walter Bright newshound at digitalmars.com
Thu May 11 12:30:28 PDT 2006


Anders F Björklund wrote:
> Walter Bright wrote:
> 
>>> I'm still naively hoping for both of "version (Unix)"
>>
>> DMD supports Windows and Linux; Unix is neither. For a compiler which 
>> targets the Unix operating system, it should set the Unix version.
> 
> 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. 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.

For example, look at the os support in the Hans Boehm gc. It's such a 
convoluted mess of #ifdef's, I don't see how anyone can modify it for 
one OS without trashing the other OS support. I'm also sure it didn't 
start out that way, it just evolved that way by accretion.



More information about the Digitalmars-d mailing list