minwin

Don Clugston dac at nospam.com.au
Fri Dec 1 01:59:17 PST 2006


Walter Bright wrote:
> Gregor Richards wrote:
>>>     version (NOTWINDOWS) => version (LINUX)
>> I hate to say this, but that example just plain stupid. All it will 
>> ever do is limit your code to work on only certain operating systems. 
>> That's hindering portability, and that's no good.
>>
>> As it turns out, it's often the case that such-and-such does work on 
>> every sane operating system, and therefore version (!Windows) makes 
>> sense.
> 
> I've seen a lot of code that did that, and it was nearly always broken. 
> That's one motivation for operating system versions should be positives, 
> not "this is for not windows" or "this is for not linux". Such 
> fundamentally are wrong, and will bite you or the maintainer sooner or 
> later.

There's a horrible effect in C++ Windows where there's lots of code 
which has #ifdef __MSVC__, even though it works on many other compilers.
So vendors like CodePlay and Metrowerks fraudulently define __MSVC__.
I hope we can avoid this in D.
I've already seen some uses of
DigitalMars_Inline_Asm
because GDC doesn't support the full set of x86 opcodes. I think failure 
to implement the spec should always be tested with a positive. Certainly 
code should never have a list of compilers which meet the spec!

And if a vendor knows that they're not implementing part of the spec, 
they should provide an identifier indicating that fact. That way, the 
vendor can fix the problem without breaking existing code.



More information about the Digitalmars-d-announce mailing list