khiops
khiops copied to clipboard
Normalize method tracing pattern
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 booleanwhile othersboolean.
Questions/Ideas
- Proposal:
- The trace booleans must be defined at the top of the method
- before or after a potential
bOk?
- before or after a potential
- Either be called
bTraceor use it as a suffix (ex.bTraceResults) - Always be
const- Do compilers warn a lot ?
- We should not expect performance gains
- The trace booleans must be defined at the top of the method
A ajouter dans le wiki dans les normes de dev + faire une autre issue de reprise de qualité de code.