debug = x overrides command line

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 22 13:28:23 PDT 2014


On Wednesday, 22 October 2014 at 20:15:57 UTC, Walter Bright 
wrote:
> On 10/22/2014 1:04 PM, Jonathan M Davis wrote:
>> Yeah, being able to just enable the debug blocks from within 
>> the code like
>> that seems questionable to me and has nothing to do with debug 
>> blocks
>> disabling pure functions. It just makes for a nastier side 
>> effect when debug
>> blocks are enabled within the code rather than via the 
>> command-line.
>
> Lots of people (like me, though I'm often told I'm a unique 
> snowflake and nobody programs like me) debug code by editting 
> the source code to enable/disable debug code rather than 
> messing with the makefile.
>
> Take a look at about any source file in dmd, for example, with 
> the commented out printf's, and template.c, with the file scope 
> #define LOG 0.
>
> D needs to support this style of debugging, and the 'debug' 
> conditional with how it is set is just the ticket. The feature 
> works as designed and intended.

I can understand that, but it does seem a bit risky in this case. 
The suggestion of creating a warning for it seems like a good 
one, since it allows you to debug like that but needles you to 
not leave it that way.

- Jonathan M Davis


More information about the Digitalmars-d mailing list