khiops icon indicating copy to clipboard operation
khiops copied to clipboard

Normalize method tracing pattern

Open folmos-at-orange opened this issue 1 year ago • 1 comments

Description

Currently, in various methods there is the following pattern to trace them:

SomeClass::SomeMethod()
{
    boolean bTrace = false;
    // <some code>

    if (bTrace)
    {
        cout << "Some trace information" << endl;
        // ...
    }
}

This pattern allows to diagnose bugs in complex code by setting bTrace = true temporarily. The pattern is not normalized because

  • There are many names for the boolean flag: bTrace, bLocalTrace, bDisplay ... etc.
  • Some of them use const boolean while others boolean.

Questions/Ideas

  • Proposal:
    • The trace booleans must be defined at the top of the method
      • before or after a potential bOk?
    • Either be called bTrace or use it as a suffix (ex. bTraceResults)
    • Always be const
      • Do compilers warn a lot ?
      • We should not expect performance gains

folmos-at-orange avatar Feb 16 '24 17:02 folmos-at-orange

A ajouter dans le wiki dans les normes de dev + faire une autre issue de reprise de qualité de code.

alexisbondu avatar Apr 10 '24 09:04 alexisbondu