Re:Ask HN: What piece of code/codebase blew your mind when y...
by pyjarrett on Monday October 31, 2022 @05:46PM
(#33413706)
C++'s "Curiously Recurring Template Pattern"
https://en.cppreference.com/w/cpp/language/crtp
[ Parent
| on HN ]
Re:Ask HN: What piece of code/codebase blew your mind when y...
by neeeeees on Monday October 31, 2022 @06:12PM
(#33414019)
Good answer. OP didn’t specify “blew your mind in a good way”.
Re:Ask HN: What piece of code/codebase blew your mind when y...
by Turing_Machine on Monday October 31, 2022 @06:20PM
(#33414122)
If "not in a good way" counts, my nominee would be discovering the hard way that a Windows C function declared as type BOOL can actually return 1,0, or -1.
Now, if it had been declared int, I would probably have been on the lookout for it using something other than 1 or 0 as an error condition, but why bother to explicitly invent a BOOL type and then abuse it that way?
Re:Ask HN: What piece of code/codebase blew your mind when y...
by dividuum on Monday October 31, 2022 @07:18PM
(#33414726)
Reminds me of this classic post: https://thedailywtf.com/articles/What_Is_Truth_0x3f_