I realize it's a joke post, but at least a couple of misleading things at the start demand correction ;)
> Well, I can always define some booleans myself! ...
Just always include stdbool.h, C versions before C99 are no longer relevant (even MSVC has mostly caught up since around 2016).
> Because booleans are nothing but unsigned integers 1 and 0.
Not really, bool/_Bool is its own native type with a size of 1 byte - IIRC the C standard might probably say 'at least 8 bits' but in reality it's always one byte (it implicitly converts to integer though).
> typedef char byte;
Not quite right if you expect `byte` to have a specific signedness, since `char`, `signed char` and `unsigned char` are technically three different types (whether char behaves like a signed or unsigned number depends on the compiler or compile target).
Also note that the new 'auto' has slightly different behaviour in GCC and Clang, and please only use it when needed (when dealing with unknown or unnamed types).
As for the rest of the post, please don't do this if you expect other people to ever read your code :)
I did almost exactly this when I was an intern at Microsoft in 1990: just the logical tests so that it read better. Everyone had a good laugh but nobody took me seriously and recently an old mentor reached out to me on LinkedIn and still remembered jokes about my fledgling coding style.
I realize it's a joke post, but at least a couple of misleading things at the start demand correction ;)
> Well, I can always define some booleans myself! ...
Just always include stdbool.h, C versions before C99 are no longer relevant (even MSVC has mostly caught up since around 2016).
> Because booleans are nothing but unsigned integers 1 and 0.
Not really, bool/_Bool is its own native type with a size of 1 byte - IIRC the C standard might probably say 'at least 8 bits' but in reality it's always one byte (it implicitly converts to integer though).
> typedef char byte;
Not quite right if you expect `byte` to have a specific signedness, since `char`, `signed char` and `unsigned char` are technically three different types (whether char behaves like a signed or unsigned number depends on the compiler or compile target).
Also note that the new 'auto' has slightly different behaviour in GCC and Clang, and please only use it when needed (when dealing with unknown or unnamed types).
As for the rest of the post, please don't do this if you expect other people to ever read your code :)
At some point the argument type changed from "unsigned int" to "byte" aka "char". But "char" is signed on many popular architectures. So this
no longer does the right thing.I did almost exactly this when I was an intern at Microsoft in 1990: just the logical tests so that it read better. Everyone had a good laugh but nobody took me seriously and recently an old mentor reached out to me on LinkedIn and still remembered jokes about my fledgling coding style.