Post B6SV7XPNmBtxqsmG8m by a1ba@suya.place
 (DIR) More posts by a1ba@suya.place
 (DIR) Post #B6SV2w6OXQN4zShZTc by karolherbst@chaos.social
       0 likes, 1 repeats
       
       "Fun bug of the month, mesa edition, episode may"so if you do "uint64_t some_var = 1 << 31;" in C you get "0xffffffff80000000" as the value, because that's super obvious and not confusing at all.It's pretty funny getting reminded how non-intuitive and broken C is from time to time.
       
 (DIR) Post #B6SV7XPNmBtxqsmG8m by a1ba@suya.place
       0 likes, 0 repeats
       
       @karolherbst that's why I have BIT and BIT64 macros that are always casted to unsigned type of appropriate size.
       
 (DIR) Post #B6SVcpNL1cyqYKk1IG by karolherbst@chaos.social
       0 likes, 0 repeats
       
       @a1ba oh yeah, we also have tons of macros for all those things, but sometimes with refactors and such sometimes things fall through cracks.
       
 (DIR) Post #B6SVcpWuS2dX21DfDE by a1ba@suya.place
       0 likes, 0 repeats
       
       @karolherbst yeah, it happens. :D
       
 (DIR) Post #B6SVwG71qGvMyhNVfU by karolherbst@chaos.social
       0 likes, 0 repeats
       
       @a1ba it shouldn't tho 😭 this is just such an awful part of the language.
       
 (DIR) Post #B6SVwGFtJK0tQBWaTw by a1ba@suya.place
       0 likes, 0 repeats
       
       @karolherbst if only there was a tool that would analyze a source code for undesired patterns...I mean unironically. A lot of bugs could've been avoided if there was a way to make C stricter. Some compiler diagnostics are useful but they don't go that far and probably shouldn't.
       
 (DIR) Post #B6SWDZlC2rbspzQEk4 by a1ba@suya.place
       0 likes, 0 repeats
       
       @karolherbst and clang-tidy is pretty much hardcoded... And I don't really want to fork it just to add what I want.