You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can anyone explain why we continue to persecute the lowly bool?
The boolean type was formally added in C99 (25 years ago!). Yes, it required a special header, but so do a lot of things. As of C23, bool is a first class type, using reserved words for bool/true/false. Yet bool continues to be discriminated against in Valkey.
Booleans are more readable and expressive. When there’s an int representing 0/1/false/true - a reader never really knows for sure that it’s ALWAYS 0/1 (or even that 0/1 necessarily represent false/true). A boolean conveys a clear intent - AND THE COMPILER ENFORCES IT.
I’ve heard people say “We don’t use bool because <insert name> doesn’t like bool”. But should we give into peer pressure and join the haters? I say NO!
This is Valkey now. It’s a brave new world. Let’s shed the shackles of “bool hate”. Rise up and be a force for love in the world!
Let’s face it, we use goto all over the place - and that’s the evil construct that our computer science instructors all warned us about. We use other C99 additions like inline functions and long long. We use enum. Is it somehow more palatable to do this?
typedef enum {notABool_False=0, notABool_True=1} NotABool; // Just silliness
As one of the few people here who was actually using C before C99, I say enough is enough.
‘Cause the good old days weren’t always good.
And tomorrow ain’t as bad as it seems.
- Billy Joel
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Can anyone explain why we continue to persecute the lowly
bool
?The boolean type was formally added in C99 (25 years ago!). Yes, it required a special header, but so do a lot of things. As of C23, bool is a first class type, using reserved words for
bool
/true
/false
. Yet bool continues to be discriminated against in Valkey.Booleans are more readable and expressive. When there’s an
int
representing 0/1/false/true - a reader never really knows for sure that it’s ALWAYS 0/1 (or even that 0/1 necessarily represent false/true). A boolean conveys a clear intent - AND THE COMPILER ENFORCES IT.I’ve heard people say “We don’t use bool because <insert name> doesn’t like bool”. But should we give into peer pressure and join the haters? I say NO!
This is Valkey now. It’s a brave new world. Let’s shed the shackles of “bool hate”. Rise up and be a force for love in the world!
Let’s face it, we use
goto
all over the place - and that’s the evil construct that our computer science instructors all warned us about. We use other C99 additions likeinline
functions andlong long
. We useenum
. Is it somehow more palatable to do this?As one of the few people here who was actually using C before C99, I say enough is enough.
‘Cause the good old days weren’t always good.
And tomorrow ain’t as bad as it seems.
- Billy Joel
Beta Was this translation helpful? Give feedback.
All reactions