4 ms·
Very true, then somebody else ends up maintaining the code and gets a ticket to add this feature and chaos plays out. One thing I learned early on - true and f
by Zenst 7y ago
Very true, then somebody else ends up maintaining the code and gets a ticket to add this feature and chaos plays out.
One thing I learned early on - true and false vary across platforms. Hence I learned to define true and false at the start of the code with realTrue=(1=1) and realFalse=(1=0). As some systems have 1 or any positive value as true, some have -1 as true. It can get messy, bit like endians (big or little) the same holds true for true and false.
- VBprogrammer 7y ago> Hence I learned to define true and false at the start of the code with realTrue=(1=1) and realFalse=(1=0) I'm sure the platforms / language you use make this a sensible choice but I'm not going to lie, if I came across that in someones code I'd be screaming WTF at the top of my lungs.
- Zenst 7y agoI learned to code in the 70's, predating C99 and having to embrace many diverse platforms (we had more than one mainframe maker back then ;). But nice explanations here: https://stackoverflow.com/questions/17010041/why-define-true-1-1-in-a-c-boolean-macro-instead-of-simply-as-1 https://stackoverflow.com/questions/17010041/why-define-true... TL;DR portability