Quantcast
Channel: Object Mentor Blog: Outliving The Great Variable Shortage
Viewing all articles
Browse latest Browse all 26

"Outliving The Great Variable Shortage" by Tim

$
0
0

Re: null, zero, false, empty, etc:

I was raised in C. In C it was considered very poor form to compare anything to “true” (1), because there are so many ‘true’ values, and relatively few ‘false’ values. We would even go so far as to define a macro (if you’ll forgive my reaching into ancient memory):
     #define IS_TRUE(x)   (!(!(x))

In C++ we ultimately got a boolean type that could be compared to true or false, but I was already trained not to compare v. true.

Does it bother me? Yeah, but I forgot that it bothered me, having not messed with it in a while.

By the way, Python gives you an unusually wide range of ‘false’ values, and I am always a little iffy about using it. I try to be careful and precise. It’s a funny game. After all, how hard is it (really) to create a boolean type with two possible values? You wouldn’t think it would take years of language evolution to get to this point.


Viewing all articles
Browse latest Browse all 26

Trending Articles