Yes, experts do this because they think they're smarter than they are. You can be smart enough once or ten times, but not N times as N→∞.
-
-
Replying to @RichFelker @elazarl and
But it's still conscious breaking of simple rules that they (we, me included) should be following.
2 replies 0 retweets 0 likes -
Replying to @RichFelker @hyc_symas and
Even assuming this is correct. Think about it like a manager. The fact that no one can really keep those rules, makes them useless
2 replies 0 retweets 1 like -
Replying to @elazarl @RichFelker and
> Details. Strict aliasing, easy? Even
@johnregehr @spun_off concludes one mitigates SA by disabling it. Stackoverflow easy? W/ recursion?1 reply 0 retweets 0 likes -
Replying to @elazarl @hyc_symas and
You can't have aliasing UB if you never cast pointers or use implicit void* conversions. Never cast pointers is basically rule #1.
4 replies 0 retweets 0 likes -
Replying to @RichFelker @hyc_symas and
Um… You can't have a UB if you never use C, but not sure it's possible to avoid it across large code base, what about inheritance,virt func?
1 reply 0 retweets 0 likes -
Replying to @elazarl @hyc_symas and
Talking about C not C++ here, and specifically aliasing UB. It's one of the easier types of UB to fully preclude.
1 reply 0 retweets 0 likes -
Replying to @RichFelker @hyc_symas and
I was talking about C as well, I meant inheritance like in the kernel. struct A { struct Parent p; }, ditto vf struct f_ops { fun_ptr p; }.
1 reply 0 retweets 0 likes -
Replying to @elazarl @hyc_symas and
Yeah, I consider it an argument for not doing that. Linux kernel is basically a tutorial on how not to write C. :-)
1 reply 0 retweets 1 like -
Replying to @RichFelker @hyc_symas and
How else would you implement inheritance?
1 reply 0 retweets 0 likes
Indeed, there's essentially no way without either round trip (unchanged type tho) through void* or container_of type tricks.
-
-
Replying to @RichFelker @elazarl and
Structure to how you do it can limit risk of mistakes, but avoiding gratuitous OOP-like design in favor of more static code is better IMO.
1 reply 0 retweets 1 like - 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.