4 ms·
Even simpler: Just use a const variable instead of a constant literal in the caller code: const bool useWayA = true; int result = foo(a, b, useWayA); inst
by rsp1984 11y ago
Even simpler: Just use a const variable instead of a constant literal in the caller code:
const bool useWayA = true;
int result = foo(a, b, useWayA);
instead of
int result = foo(a, b, true);
- mortoray 11y agoThis would essentially be the enum option: giving names to constants. But this way wouldn't enforce the convention, you could still use `true` or `false`.