9
Cosmic Rays? (lemmy.tgxn.net)
submitted 2 years ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 2 points 2 years ago* (last edited 2 years ago)

Any sane compiler will simplify this into

    function cosmicRayDetector() {
      while(true) {
      }
    }

C++ may further 'simplify' this into

    function cosmicRayDetector() {
      return
    }
[-] [email protected] 3 points 2 years ago

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

volatile bool condition = true;
while(condition) {
}
printf("Cosmic ray detected");
this post was submitted on 14 Jun 2023
9 points (100.0% liked)

Programmer Humor

36300 readers
426 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS