Predefined Version expansion

Derek Parnell derek at psych.ward
Tue Apr 3 08:12:39 PDT 2007


On Tue, 03 Apr 2007 10:48:01 -0400, Dan wrote:

> Walter Bright Wrote:
>> I think what you need is a runtime check, which is provided in std.cpuid.
> 
> So what you're saying is, we can't optimize the compiler for a specific
> variation of the x86, and are therefore stuck with writing generic 
> programs that branch off for each cpu kind during runtime?


No, maybe you missed the point. It certainly is possible for one to create
editions of an application for specific hardware configurations; and using
the version() statement is a reasonable way to do that.

  version(SSE2) { . . . }
  version(SSE)  { . . . }
etc...

  dmd -version=SSE2 myapp.d
  dmd -version=SSE myapp.d

However, such editions should be able to be generated regardless of which
hardware architecure the compiler just happens to be running on at the
time. In other words, setting the version values within the compiler based
on the hardware at compilation time is not very useful. It would be better
to set these version values at the compiler command line level, if one does
really want hardware-specific editions of the app.


-- 
Derek Parnell
Melbourne, Australia
"Justice for David Hicks!"
skype: derek.j.parnell



More information about the Digitalmars-d mailing list