Predefined Version expansion

Dan murpsoft at hotmail.com
Tue Apr 3 08:35:18 PDT 2007


Derek Parnell Wrote:

> 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.

Yeah, I guess defining the versions yourself is totally possible, and reasonable.  : p

Less persuasively, and more as a closing note, I tend to think that the more D is used for other platforms (GDC retargetable?) the more those predefined platform ones will be wanted.  

It's generally bad to have each programmer use different names for exactly the same thing.



More information about the Digitalmars-d mailing list