mydebug = false, if (mydebug)

Issue #29 resolved
Nico Schlömer created an issue

Various times around the code base, one finds

bool mydebug = false;
if (mydebug) {

Probably, those mydebugs should be replaced by an

#ifndef NDEBUG

Comments (4)

  1. Iulian Grindeanu

    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?

  2. Nico Schlömer 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) {
    
  3. Vijay M

    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.

  4. Log in to comment