Below you will find pages that utilize the taxonomy term “C”
Posts
The undervalued bool
A colleague of mine wanted to reduce the repetition in this fragment of C++:
funcA(false); funcB(false); funcC(false); funcD(false); funcA(true); funcB(true); funcC(true); funcD(true); and, in a burst of sheer genius, came up with this solution:
for (bool status = false; status <= true; ++status) { funcA(status); funcB(status); funcC(status); funcD(status); } He then scratched his head as the program looped for eternity.
Who could have predicted that a common-or-garden bool could have so many values?