All:

In the copyPropagation rewrite, I used the idiom:

  #if DEBUG_CP
    static unsigned debug = 0;
  #endif
  ...
  #if DEBUG_CP
    if (debug > 0)
      print_some_debug_output(...);
  #endif

There are several advantages to this approach:
  - The conditionally-compiled blocks clearly set off the debugging code from 
the rest of the program.
  - They can be turned off at compile time, so the debug code does not impact 
compiler performance.
  - Having the actual debug behavior depend on a static variable allows a 
person debugging the code to turn this on and off within the debugger.
  - Of course, one can also have debug statements the execute unconditionally, 
or depend on a global flag (set by a command-line switch).

In particular, I think that the isolation of debugging code is an appropriate 
use of conditional compilation in our code base.

THH

________________________________________
From: Brad Chamberlain [[email protected]]
Sent: Friday, June 06, 2014 10:37 AM
To: [email protected]
Subject: Re: [Chapel-developers] [Chapel-commits] SF.net SVN: chapel:[23494] 
trunk/compiler/resolution/callDestructors.cpp

I could be in the minority, but I think commented out debugging lines are
useful and only slightly poorer taste than #ifdef'd out debugging lines.
If I were working in a particular pass, I'd rather uncomment/unifdef those
lines to find out what they printed and indicated to the previous
developer rather than sorting out what was going on and putting in my own
debugging lines from scratch...

-Brad



On Thu, 5 Jun 2014, [email protected] wrote:

> Revision: 23494
>          http://sourceforge.net/p/chapel/code/23494
> Author:   lydia-duncan
> Date:     2014-06-05 16:40:31 +0000 (Thu, 05 Jun 2014)
> Log Message:
> -----------
> These lines appear to be debugging lines from when the method
> changeRetToArgAndClone was first created.  They've been commented out ever 
> since
> and don't seem to contribute any new functionality, so I'm removing them.
>
> Modified Paths:
> --------------
>    trunk/compiler/resolution/callDestructors.cpp
>
> This was sent by the SourceForge.net collaborative development platform, the 
> world's largest Open Source development site.
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> _______________________________________________
> Chapel-commits mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/chapel-commits
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to