Why version() ?

Daniel Keep daniel.keep.lists at gmail.com
Tue Feb 10 19:03:20 PST 2009



grauzone wrote:
> I see your points, although I don't quite agree. Programmers will
> continue to do stupid things, even if it hurts. And in these cases,
> having an "intentionally hard to use" version-statement might increase
> the overall mess even further.
> 
> But what do you say about the possibility of uncatched typos? (the
> "version(linxu) {" example)

Versions are not boolean flags that are either true or false [1].
They're zero-state flags that either exist or don't.  You can't
spell-check something which simply may not exist.

So let's say you have to define all version identifiers.  The problem
with this is that the more you use versioning, the more hideous your
compile-lines are going to become...

dmd foo --version=UseMMX=false --version=UseSSE=false
--version=UseSSE2=true --version=Use3DNow=false
--version=UseSSE2_AMD=false --version=UseSSE3=false
--version=UseSSE4=false --version=UseSPARCExtension=false
--version=UseAltivec=false --version=UseARMStuff=false
--version=OhGodMakeItStop=false

As opposed to

dmd foo --version=UseSSE2

You might be able to rework the syntax so that you can define the
default value of a version symbol in a module, then override it from the
command line.

module simd_versions;
version UseMMX=false, UseSSE=false, UseSSE2=false, ...;

  -- Daniel


[1] I'm ignoring integer versions which have a similar problem, but
would just make this post longer :P



More information about the Digitalmars-d mailing list