Lemmy Coupou.fr
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
t҉̠̙ǵ̣̞̄ͪ͜x̸̱͚̳ͫ͐̑̈ͯͣ̚n̒͌҉͉̦̜̝ͅ@lemmy.tgxn.net to Programmer Humor@lemmy.mlEnglish · 2 years ago

Cosmic Rays?

lemmy.tgxn.net

message-square
7
link
fedilink
28

Cosmic Rays?

lemmy.tgxn.net

t҉̠̙ǵ̣̞̄ͪ͜x̸̱͚̳ͫ͐̑̈ͯͣ̚n̒͌҉͉̦̜̝ͅ@lemmy.tgxn.net to Programmer Humor@lemmy.mlEnglish · 2 years ago
message-square
7
link
fedilink
alert-triangle
You must log in or register to comment.
  • Xanvial@beehaw.org
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 years ago

    You should add returns ray detected outside of while loop

    • flambonkscious@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      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@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    2 years ago

    Any sane compiler will simplify this into

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

    C++ may further ‘simplify’ this into

        function cosmicRayDetector() {
          return
        }
    
    • LuciferMorningWood@lemm.ee
      link
      fedilink
      English
      arrow-up
      3
      ·
      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");
      
  • Attempted_Render@lemmy.fmhy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 years ago

    True

    • tj111@lemmy.fmhy.ml
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      False

      • Attempted_Render@lemmy.fmhy.ml
        link
        fedilink
        English
        arrow-up
        3
        ·
        2 years ago

        cosmic ray detected.

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml

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

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 260 users / day
  • 1.76K users / week
  • 3.15K users / month
  • 10.1K users / 6 months
  • 1 local subscriber
  • 35.9K subscribers
  • 1.89K Posts
  • 39K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.11
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org