Version Identifiers for Platforms / Architectures not supported byDMD

Nick Sabalausky a at a.a
Thu Nov 10 05:24:31 PST 2011


"Walter Bright" <newshound2 at digitalmars.com> wrote in message 
news:j9f442$k3p$1 at digitalmars.com...
> On 11/9/2011 6:46 AM, Daniel Murphy wrote:
>> But, as it is a breaking change (very slightly), and a
>> special case, I doubt this will ever happen unless Walter loves the idea.
>> Walter?
>
> Sorry, I don't love the idea. I dislike it for its inconsistency with the 
> rest of the language. The trend in programming languages and operating 
> systems has, for a long time, been towards case sensitivity.
>
> BTW, the correct way to write version sensitive code is:
>
> version (linux)
> {
>    ...
> }
> else version (OSX)
> {
>    ...
> }
> else
>    static assert(0, "unsupported OS version");
>

I don't think you're going to get most people to go through the bother of 
doing this, do you? I agree this is the right thing to do, *now that I see 
it pointed out*, but even at that it's going to remain tempting not to 
bother (and easy to forget).

Maybe there should be an error when no part of a version...else chain gets 
used? That way the "static assert(0);" becomes implicit, and people aren't 
going to fuck it up by forgetting, not knowing to do it, or feeling too lazy 
to bother.




More information about the Digitalmars-d mailing list