Conversation
Notices
-
Embed this notice
:segasaturn: (takao@shitposter.club)'s status on Wednesday, 28-Feb-2024 19:36:17 JST :segasaturn:
@Moon so on a scale of 0 to 255, how hard do we glow? :terryno: -
Embed this notice
翠星石 (suiseiseki@freesoftwareextremist.com)'s status on Wednesday, 28-Feb-2024 19:36:10 JST 翠星石
@r It depends actually.
On AMD64, if you overflow unsigned by just a bit, it overflows into a larger value anyway.
#include <stdio.h>
int main()
{
unsigned long e = 9223372036854775807 + 2;
printf("%lu\n", e);
}
main.c:6:47: warning: integer overflow in expression of type ‘long int’ results in ‘-9223372036854775807’ [-Woverflow]
6 | unsigned long e = 9223372036854775807 + 2;
| ^
翠星石 ~ $ ./a.out
9223372036854775809 -
Embed this notice
r (r@freesoftwareextremist.com)'s status on Wednesday, 28-Feb-2024 19:36:11 JST r
@smug @Moon @takao Technically speaking, that's not how overflow works, but yeah. -
Embed this notice
smug@smuganimeavatar.xyz's status on Wednesday, 28-Feb-2024 19:36:12 JST smug
nice overflow
-
Embed this notice
r (r@freesoftwareextremist.com)'s status on Wednesday, 28-Feb-2024 19:36:16 JST r
@takao @Moon 256, I assume. :senko3: -
Embed this notice
翠星石 (suiseiseki@freesoftwareextremist.com)'s status on Wednesday, 28-Feb-2024 19:40:34 JST 翠星石
@r Wait, I actually overflowed signed and not unsigned. You need to case to (unsigned long) to stop gcc from complaining in that case.
I remember receiving a gcc warning that a value was so large that it overflowed into the larger unit size, but I haven't been able to replicate it so far.
-
Embed this notice