Post B5iY1eJQYaKW7MidcG by ratsnakegames@mastodon.social
 (DIR) More posts by ratsnakegames@mastodon.social
 (DIR) Post #B5iVZpylO3M4HifEh6 by eniko@mastodon.gamedev.place
       0 likes, 0 repeats
       
       just found out that C says its undefined behavior to *construct*, not dereference out of bounds pointers?yeah i uh, i think i'm gonna go ahead and not care about that one sorry
       
 (DIR) Post #B5iVZqE0TNY32znPSC by ratsnakegames@mastodon.social
       0 likes, 0 repeats
       
       @eniko sounds like "this is obviously going to fail but we didn't specify how exactly it should fail"
       
 (DIR) Post #B5iVZqOdpq3TZylu1w by eniko@mastodon.gamedev.place
       0 likes, 0 repeats
       
       @ratsnakegames i mean if you don't dereference an out of bounds pointer it will not, on any system known to man, fail
       
 (DIR) Post #B5iVZqX9KCrQ0MkhI8 by ratsnakegames@mastodon.social
       0 likes, 0 repeats
       
       @eniko i mean, you have a pointer that is useless and invalid so that is kind of a failure imo - just one that is not immediately apparenti could imagine that some obscure compiler did an out-of-bounds check on pointer creation?
       
 (DIR) Post #B5iVZqiqciDaaeE2We by eniko@mastodon.gamedev.place
       0 likes, 0 repeats
       
       @ratsnakegames imagine you're drawing a vertical line in a framebufferevery step of your for loop you increment the destination pointer by the width of the framebuffernow at the end, you've constructed a pointer that violates this UB
       
 (DIR) Post #B5iVZqri5lJ728N7L6 by fiore@brain.worm.pink
       0 likes, 0 repeats
       
       @eniko @ratsnakegames couldnt  you just  stop  the loop before reaching the  OOB  region ?  /genq
       
 (DIR) Post #B5iY1e85ElFvYBPZw0 by eniko@mastodon.gamedev.place
       0 likes, 0 repeats
       
       @fiore @ratsnakegames not with a for loop, no
       
 (DIR) Post #B5iY1eJQYaKW7MidcG by ratsnakegames@mastodon.social
       1 likes, 0 repeats
       
       @eniko @fiore one approach i could think of is to have the loop run over an int from 0 to PIXEL_COUNT, then construct the pointer WITHIN the for loop (i.e. after the for loop's check has been passed)
       
 (DIR) Post #B5iY2PrPm2RXaNywcK by fiore@brain.worm.pink
       0 likes, 0 repeats
       
       @ratsnakegames @eniko oh yea that  works
       
 (DIR) Post #B5iZevSkpFf8YaNFOi by Erato_Heti@social.xenofem.me
       1 likes, 0 repeats
       
       @fiore @eniko @ratsnakegames my awkward nonbinary ally manager trying to reassure me the person im working with today can be relied on: