A bool
or enum
by any other name:
Toggles in functions
by Andrzej Krzemieński
From the article:
Have you ever seen a function call like this?
process(true, false);We are processing something: this should be clear from the context. But what do these parameters mean? What is
We will have to stop, and take a look at the declaration, and it does give us a hint:true
and what isfalse
? From the function call we will never figure it out. The code surely isn’t self explanatory.void process(bool withValidation, bool withNewEngine);Apparently, the author of the function uses the two
bool
s as toggles...
Add a Comment
Comments are closed.