Why version() ?

Sergey Gromov snake.scaly at gmail.com
Sun Feb 15 16:24:32 PST 2009


Tue, 10 Feb 2009 13:34:35 +0100, grauzone wrote:

> Frits van Bommel wrote:
>> grauzone wrote:
>>> Some severe disadvantages of version():
>>> 1. They can't contain expressions (like "version(linux && mac)").
>> 
>> Unless Apple has plans to s/BSD/Linux/ in MacOS that I'm not aware of, 
>> version(linux || mac) would probably be more useful...
>> 
>> Allowing boolean expressions (using only version identifiers) in 
>> version() would be a very welcome feature.
>> 
>> I'm not sure about the rest of your post though.
> 
> Well, my argument is that CTFE already provides all version features and 
> even more. version is redundant, and even dangerous, because it can't 
> catch typos in version identifiers.
> 
> Actually, C/C++ has something similar: #if (is similar to static if) 
> versus #ifdef (is similar to version). ffmpeg recently switched from 
> using #ifdef to #if.

#if is no different from #ifdef because any undefined identifier
evaluates to 0 within the #if context.



More information about the Digitalmars-d mailing list