PPl, we have debugging stuff being dumped that really isn't
needed when things work.
For some key components an explict debug flag is set during
or just after the controlling object is constructed.
Whilst this is correct, many objects don't have a debugging
flag, and organising to transfer one may be a lot of hassle.
A nasty hacky ugly solution is to have our very first
global variable .. a debug switch. Then those fprintfs
could be conditionalised, avoiding output in demos,
testing, and production code.
I hate global variables with a vengance, however the
wrapper for this:
static bool debug_flag = false;
bool debug() { return debug_flag; }
void set_debug(bool flag) { debug_flag = flag; }
has a performance problem.
On the other hand a global variable will also incur
a hit with dynamic loading.
Either way -DNDEBUG should turn off access entirely.
The problem is I just don't trust global variables
in a dynamic loading context. Any thoughts?
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language