Predefined Version expansion

Dan murpsoft at hotmail.com
Wed Apr 4 12:37:53 PDT 2007


Dave Wrote:
> Just a thought for D -- add a global CPU type to the D standard runtime that is set during 
> initialization (i.e.: in Dmain) that can be used by user code like BLADE and by the compiler itself 
> for (future) processor determined optimization branches.
> 
> Actually, I'm kind-of surprised one isn't there already (or is it?).

There is already a cpu variable/object/module or something within the phobos library which provides cpu related information.  The problem being discussed is that this information is stored and branches are made based on the cpu type during *runtime*.

If instead, it was pre-determined during compile time, these branches could be optimized out.  Since version() is designed to perform precisely this function, it makes sense to continue to use version() to identify and target cpu's during compile time.





More information about the Digitalmars-d mailing list