DMD 1.005 release

Walter Bright newshound at digitalmars.com
Wed Feb 7 11:00:43 PST 2007


Anders F Björklund wrote:
> Walter Bright wrote:
> 
>>> Why is that evil? I think it's actually a great idea. "versions" are 
>>> a sort of configuration that determines which code should be compiled 
>>> and which code shouldn't. Storing this configuration in a separate 
>>> file makes sense to me.
>>
>> The right way to do versions that cut across multiple files is to 
>> abstract the versioning into an API, and implement the different 
>> versions in different modules.
>>
>> This is a lot easier to manage when you're dealing with larger, more 
>> complex code, although it is more work up front.
> 
> 
> How would you use something like autoconf with this approach ?
> 
> Would it need to generate different Makefiles / D file lists for
> different options/versions, instead of just -version statements ?
> Example of things I am thinking about are "__WXGTK__", "UNICODE",
> or "HAVE_OPENGL". With C/C++, they're usually in a config.h file.

I've worked with the C approach for many years, and have gotten 
increasingly dissatisfied with it. Over time, it leads to conflicting, 
misused, overlapping version macros.

I've also tried the "make an API for the version" method, and have been 
much more satisfied with it. You can see it at work in the gc 
implementation (see gclinux.d and win32.d).



More information about the Digitalmars-d-announce mailing list