Discussion
MOND←TECH MAGAZINE
RobotToaster: >and that it takes up one byte of memoryYou can make them smaller using bitfields in C.
russdill: Um, no. Please show me how you can fit 255 possible states in something smaller than a byte by using bitfields.
ralferoo: True | False | FileNotFound was a meme about 2 decades ago, and even that was a reference to MSDOS from another 2 decades earlier. I guess things never change, only the language.Even now, I still find myself using true/false/null on occasions, but I'm usually smart enough to replace it with an enum at that point. The only time I don't is when it's an optional parameter to a function to override some default/existing value, at which point it then makes sense to keep it as an optional bool.
hinkley: I did a govt contract early on and learned that yes/no/unanswered/unasked was a common quad. I see that in disclosures when applying for jobs as well.
gizmo686: I'm surprised that trinary logic has not become a standard part of standard libraries yet. Almost every project I have worked on ends up with some form of a yes/no/maybe abstraction.
gizmo686: It's not clear from the article, but "niche optimization" does not mean "optimization that is only useful in a very specific circumstance".It is a specific optimization based on the idea of storing one type inside of another type by finding a "niche" of unused but pattern(s) inside the second type.It has far more useful application than a tower of Option 254 deep.