A cool Lemmy
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
cm0002@lemmy.zip to Programmer Humor@programming.dev · 9 days ago

More code = more better

lemmy.zip

message-square
81
link
fedilink
1

More code = more better

lemmy.zip

cm0002@lemmy.zip to Programmer Humor@programming.dev · 9 days ago
message-square
81
link
fedilink
  • Hirom@beehaw.org
    link
    fedilink
    arrow-up
    0
    ·
    9 days ago

    The compiler will optimize it anyway. /s

    • Dumhuvud@programming.dev
      link
      fedilink
      English
      arrow-up
      0
      ·
      9 days ago

      You jest, but you aren’t wrong. At least if we are talking about C, C++ or Rust. https://godbolt.org/z/oPPfdfcf5

      .NET compiler is weak when it comes to optimizing your code; I assume Go’s is as bad.

      • Yggstyle@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        9 days ago

        Technically yes… But I think he was more making the excuse for the gore “from the goresmith’s perspective.”

        And I’m not sure if the compiler in any language would change a random check function… The others are a possibility.

    • yetAnotherUser@discuss.tchncs.de
      link
      fedilink
      arrow-up
      0
      ·
      9 days ago

      Not sure about the last one though. The other two are trivial to optimize away.

      • Hirom@beehaw.org
        link
        fedilink
        arrow-up
        0
        ·
        9 days ago

        An infinite loop canot be ruled out in the last case, so a compiler couldn’t optimize this away without potentially changing the program behavior.

        • yetAnotherUser@discuss.tchncs.de
          link
          fedilink
          arrow-up
          0
          ·
          9 days ago

          Infinite loops are often weird though. They could be seen as undefined behavior and the compiler may do whatever it feels like.

          • ronigami@lemmy.world
            link
            fedilink
            arrow-up
            0
            ·
            9 days ago

            How could an infinite loop be considered UB?

Programmer Humor@programming.dev

programmer_humor@programming.dev

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: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

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

  • 86 users / day
  • 431 users / week
  • 1.38K users / month
  • 2.8K users / 6 months
  • 0 local subscribers
  • 28K subscribers
  • 753 Posts
  • 9.18K Comments
  • Modlog
  • mods:
  • adr1an@programming.dev
  • Feyter@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • UI: unknown version
  • BE: 0.19.13
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org