Yes, you're right with your comments, hence a new idiom ...
Still the current solution (with #ifdef, see the commit message) doesn't seem right either.
I would prefer (a family of) options to turn this on/off per file (not per class or whatever because that is not obvious to the debugger), and to revise the QL_*OUT with that.
In CoSy we had a standard 'engine' (is pass here) option called 'debug' which has a level as value (similar to log_level) which requires QL_DOUT to be sensitive to a pass-level variable set by this option. The latter requires C++ expertise to implement here. The pass level is not appropriate in OpenQL because there is so much common code (not in pass) although we could interpret 'pass' dynamically, i.e. QL_DOUT encountered between the start and stop of a particular pass, which would include the common code too when it is executed on behalf of that pass.
This should be a separate design and not pursued in this current PR.
Yes, you're right with your comments, hence a new idiom ...
Still the current solution (with #ifdef, see the commit message) doesn't seem right either. I would prefer (a family of) options to turn this on/off per file (not per class or whatever because that is not obvious to the debugger), and to revise the QL_*OUT with that. In CoSy we had a standard 'engine' (is pass here) option called 'debug' which has a level as value (similar to log_level) which requires QL_DOUT to be sensitive to a pass-level variable set by this option. The latter requires C++ expertise to implement here. The pass level is not appropriate in OpenQL because there is so much common code (not in pass) although we could interpret 'pass' dynamically, i.e. QL_DOUT encountered between the start and stop of a particular pass, which would include the common code too when it is executed on behalf of that pass. This should be a separate design and not pursued in this current PR.