can you give a gcc explorer link? I can try to fix
-
-
On mobile browser atm but just int f(unsigned a,unsigned b) {return a>UINT_MAX/b;}
5 replies 0 retweets 1 like -
btw LLVM and GCC both already emit pretty good code for thispic.twitter.com/44LMxlYX1D
1 reply 0 retweets 0 likes -
That's a buggy test; it assumes long is twice as wide as int.
1 reply 0 retweets 0 likes -
Replying to @RichFelker @johnregehr and
Even if you fix that detail using right types, it assumes _existence_ of a double-width type...
1 reply 0 retweets 0 likes -
Replying to @RichFelker @johnregehr and
..which is false for size_t on a 64-bit system.
1 reply 0 retweets 1 like -
Replying to @RichFelker @johnregehr and
Even with existence, it's buggy. It should be `unsigned long`.
1 reply 0 retweets 1 like -
Replying to @stephentyrone @RichFelker and
As written g(-1,-1) does signed overflow if long is 64b and unsigned is 32b.
1 reply 0 retweets 1 like -
-
Replying to @johnregehr @stephentyrone and
I love this thread, it really captures C programming accurately.
2 replies 2 retweets 7 likes
Yes, ppl keep suggesting bogus ways to do something with an obvious soln
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.