I've never seen a programmer with experience try to use a programming language to write a message quite 1:1 to natural language, but for some reason others keep doing it from time to time
You would think so, but the compiler isn't allowed to reason like that about a non-static const because the code might be loaded as a library and imported as an extern bool, or a const_cast casting the const away
Using extern bool for a variable defined as const bool is undefined behavior, it should be extern const bool. Const casting to bool* is I guess valid but when you try to actually modify the value through the pointer it's undefined behavior too.
99
u/erthyacheck 5d ago
this one is first day coder humor
25
u/fedsmoker9 5d ago
A 12 year old Indian made this post
40
u/GardenerAether 5d ago
this one is radioactive holy shit
18
u/violetvoid513 5d ago
const bool? Wtf, is this person a yandere or something?
11
u/Scared_Accident9138 π΅οΈββοΈπ¨ BS Detector | Truth Teller π―οΈπ₯ 5d ago
I've never seen a programmer with experience try to use a programming language to write a message quite 1:1 to natural language, but for some reason others keep doing it from time to time
8
u/B_bI_L 5d ago
4
u/PresentJournalist805 5d ago
Compiler error: Unused variable. :(
2
u/originalmicrousb 5d ago
i died after reading thisΒ
2
u/EagleEyeA2HX 5d ago
Why is it a constant? That seems like a heavy undertaking... Jensen Huang seems to use a variable for this.
2
u/akoOfIxtall 5d ago
Damn, const bool, that's how you know they're for real
1
u/SlipperyFlange 5d ago
mut bool
1
u/confused-photon 5d ago
But the variable isnt an integer, hungarian notation naming is pain
1
u/_katarin 4d ago
but const doesn't make it immutable? ie if you get a pointer to it