Versioning best practices

Thomas Kuehne thomas-dloop at kuehne.cn
Thu Jan 25 10:04:14 PST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

BCS schrieb am 2007-01-24:
> Thomas Kuehne wrote:
>> Lars Ivar Igesund schrieb am 2007-01-24:
>> 
>>>I've been looking at what D and the compilers provide to help with
>>>successfully versioning D source code in such a way that it minimizes
>>>duplication of code (and in the process ease organization of said code),
>>>ease readability and ease building.
>> 
>> [...]
>> 
>>>Do you think that the current tools are adequate?
>> 
>> 
>> Most of the times versioning is the wrong approach. I think C's
>> (and to a lesser extend C++'s) non-existing compile time reflection
>> forced everyone to use versioning instead of "featuring".
>
> Shouldn't version be used for adding or not adding a feature? I'm 
> thinking of, for example, building a compiler with extensions where the 
> extensions are optional*.

Maybe we have different concepts of versioning.

C:
#if USE_REENTRANT
#if GLIBC > 1

The first line is a feature test while the second one is a version test.
If you use D's "version(...)" to check features that's fine.

Versioning in the strict sense(line 2) however is usually not a good
design - unless your are trying to bypass some library bugs, though fixing those
should be the primary approach.

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFFuPsgLK5blCcjpWoRAhY0AKCs40FgnpbtBHPzjyGJTIjA8ehARgCeIW8J
Sq/5DhbsuAMXdFNk07GTi4o=
=Xc4r
-----END PGP SIGNATURE-----



More information about the Digitalmars-d mailing list