mydebug = false, if (mydebug)
Various times around the code base, one finds
bool mydebug = false;
if (mydebug) {
Probably, those mydebug
s should be replaced by an
#ifndef NDEBUG
Comments (4)
-
-
reporter left there for live debugging only
I guess. It a little weird that such debugging code is found in production master. Using
#ifndef
would always remove this code from production builds, always include it in debug builds. Perhaps that benefits both use cases. (And is the default, too.assert()
does the same thing for example.)Where do you see those?
In various places:
$ grep mydebug * -r src/SequenceManager.cpp: bool mydebug = false; src/SequenceManager.cpp: if (mydebug) { src/SequenceManager.cpp: bool mydebug = false; src/SequenceManager.cpp: if (mydebug) { src/VarLenDenseTag.cpp: bool mydebug = false; src/VarLenDenseTag.cpp: if (mydebug) { src/io/WriteNCDF.cpp: bool mydebug = false; src/io/WriteNCDF.cpp: if (mydebug) { src/io/WriteNCDF.cpp: bool mydebug = false; src/io/WriteNCDF.cpp: if (mydebug) { src/DenseTag.cpp: bool mydebug = false; src/DenseTag.cpp: if (mydebug) { src/DenseTag.cpp: bool mydebug = false; src/DenseTag.cpp: if (mydebug) { src/TypeSequenceManager.cpp: bool mydebug = false; src/TypeSequenceManager.cpp: if (mydebug) { src/TypeSequenceManager.cpp: bool mydebug = false; src/TypeSequenceManager.cpp: if (mydebug) { src/VarLenSparseTag.cpp: bool mydebug = false; src/VarLenSparseTag.cpp: if (mydebug) { src/SparseTag.cpp: bool mydebug = false; src/SparseTag.cpp: if (mydebug) { src/MeshTag.cpp: bool mydebug = false; src/MeshTag.cpp: if (mydebug) {
-
Nico, agreed that these need to be fixed. I think for the most part, the debug blocks can be removed and I see no reason for them to hang around anymore. These are code from pre-2010 era and the developers who worked on it are not with the team anymore.
-
- changed status to resolved
sanitize debug code
Replaced a bunch of
bool mydebug = false; if (mydebug) {
combos by the canonical#ifndef NDEBUG
.Fixes bug
#29.→ <<cset 8c02ea395e82>>
- Log in to comment
those mydebugs are probably left there for live debugging only. (so change in the debugger the value of mydebug). Sometimes are passed as runtime option.
Where do you see those?