version and debug statements

BCS BCS at pathlink.com
Thu May 11 16:08:25 PDT 2006


Walter Bright wrote:
[...]
> In C and C++, I often see:
> 
>     #if !WIN32
> 
> when what is really meant is:
> 
>     #if linux
> 
> i.e. the former is almost always a bug waiting to happen (when someone 
> tries to compile for a third operating system). Versions should be "this 
> build is for this configuration" rather than "this build is not for that 
> configuration."
> 

what about the case where feature A is incompatible with configuration B 
(example: this feature is usually part of the config but doesn't work 
under win32)

but then again I'd do this instead

version(WIN32)
{
	pragma(msg,">"__FILE__":" ~ itoa!(__LINE__) ~
	"Sorry this doesn't work with win32");
}
else
{
	// win32 incompatible code
}



More information about the Digitalmars-d mailing list