Xanvial, You should add returns ray detected outside of while loop
flambonkscious, That resembles some of my PowerShell waaay too much. If it wasn’t for the cosmic ray thing, I thought this was my GitHub…
chkno, Any sane compiler will simplify this into
<span style="color:#323232;"> function cosmicRayDetector() { </span><span style="color:#323232;"> while(true) { </span><span style="color:#323232;"> } </span><span style="color:#323232;"> } </span>
C++ may further ‘simplify’ this into
<span style="color:#323232;"> function cosmicRayDetector() { </span><span style="color:#323232;"> return </span><span style="color:#323232;"> } </span>
LuciferMorningWood, Iirc the issue was that while(true) would be removed while it should be replaced with ret and this caused a bug where the binary would execute next function
But I believe this way of cosmic ray detection would work
<span style="color:#323232;">volatile bool condition = true; </span><span style="color:#323232;">while(condition) { </span><span style="color:#323232;">} </span><span style="color:#323232;">printf("Cosmic ray detected"); </span>
Add comment