Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Programmer Humor
  3. // Implement

// Implement

Scheduled Pinned Locked Moved Programmer Humor
programmerhumor
24 Posts 17 Posters 1 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • maven@lemmy.zipM [email protected]
    This post did not contain any content.
    A This user is from outside of this forum
    A This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #10

    If those are normal integers, the compiler optimizes that to a simple compare and branch/cmov.

    eager_eagle@lemmy.worldE 1 Reply Last reply
    5
    • myturtleswimsupsidedown@fedia.ioM [email protected]

      implemented

      kairubyte@lemmy.dbzer0.comK This user is from outside of this forum
      kairubyte@lemmy.dbzer0.comK This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #11

      So one understood the assignment.

      1 Reply Last reply
      11
      • L [email protected]

        That is why it is loved: it allows you to use ideas/objects the same way as you do as an engineer. Super cool.

        M This user is from outside of this forum
        M This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #12

        But when you do shoot yourself in the foot, it blows your whole leg off.

        L 1 Reply Last reply
        2
        • eager_eagle@lemmy.worldE [email protected]

          yes, but in this particular case I wouldn't want to second guess my decrement operation just happens to also be calling the white house or whatnot. Just make a method.

          S This user is from outside of this forum
          S This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #13

          It is a method!

          eager_eagle@lemmy.worldE 1 Reply Last reply
          5
          • S [email protected]

            It is a method!

            eager_eagle@lemmy.worldE This user is from outside of this forum
            eager_eagle@lemmy.worldE This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #14

            thanks

            1 Reply Last reply
            3
            • M [email protected]

              But when you do shoot yourself in the foot, it blows your whole leg off.

              L This user is from outside of this forum
              L This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #15

              As a shotgun. That's why people don't shoot themselves in the foot with a shotgun.

              iavicenna@lemmy.worldI 1 Reply Last reply
              1
              • L [email protected]

                That is why it is loved: it allows you to use ideas/objects the same way as you do as an engineer. Super cool.

                C This user is from outside of this forum
                C This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #16

                Until the next person with a slightly different mental way of defining things comes along. Or just a future version of you.

                1 Reply Last reply
                12
                • eager_eagle@lemmy.worldE [email protected]

                  yes, but in this particular case I wouldn't want to second guess my decrement operation just happens to also be calling the white house or whatnot. Just make a method.

                  L This user is from outside of this forum
                  L This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #17

                  You wouldn't second guess the decrement operation if it's a basic type like int. If I opt into using complex types, then I am responsible to understand/establish/forbid the syntactic sugar for it. That's the mindset I often use to program C++

                  1 Reply Last reply
                  0
                  • L [email protected]

                    It might be an absolutely adequate method. Imagine that is C++. operator-- is overloaded and controls some machinery. You can't just command capacity = currSize. Process is important.

                    M This user is from outside of this forum
                    M This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #18

                    Yeah, just to say it more clearly: that kind of thing is why lots of people out there insist that operator overloading is a bad idea.

                    And yeah, it's a C++ thing that mostly doesn't happen in other languages.

                    teamassimilation@infosec.pubT 1 Reply Last reply
                    12
                    • eager_eagle@lemmy.worldE [email protected]

                      yes, but in this particular case I wouldn't want to second guess my decrement operation just happens to also be calling the white house or whatnot. Just make a method.

                      L This user is from outside of this forum
                      L This user is from outside of this forum
                      [email protected]
                      wrote on last edited by [email protected]
                      #19

                      That's just life of a C++ programmer: you second guess everything, and there are still optimization you haven't tried, and pitfalls you haven't got into

                      1 Reply Last reply
                      0
                      • A [email protected]

                        If those are normal integers, the compiler optimizes that to a simple compare and branch/cmov.

                        eager_eagle@lemmy.worldE This user is from outside of this forum
                        eager_eagle@lemmy.worldE This user is from outside of this forum
                        [email protected]
                        wrote on last edited by [email protected]
                        #20

                        for others - https://godbolt.org/z/osaKrxsPx

                        1 Reply Last reply
                        1
                        • maven@lemmy.zipM [email protected]
                          This post did not contain any content.
                          J This user is from outside of this forum
                          J This user is from outside of this forum
                          [email protected]
                          wrote on last edited by [email protected]
                          #21

                          Thank goodness for the JIT and compiler optimizations.

                          isveryloud@lemmy.caI 1 Reply Last reply
                          7
                          • M [email protected]

                            Yeah, just to say it more clearly: that kind of thing is why lots of people out there insist that operator overloading is a bad idea.

                            And yeah, it's a C++ thing that mostly doesn't happen in other languages.

                            teamassimilation@infosec.pubT This user is from outside of this forum
                            teamassimilation@infosec.pubT This user is from outside of this forum
                            [email protected]
                            wrote on last edited by
                            #22

                            Sincerely agree. Explicit is better then implicit, that’s a general engineering axiom.

                            Instead of overloading and making the next maintainer hunt for overloads, a clearly named function that does the critical steps would make the code immensely more maintainable. C++ is C gone wild.

                            1 Reply Last reply
                            2
                            • J [email protected]

                              Thank goodness for the JIT and compiler optimizations.

                              isveryloud@lemmy.caI This user is from outside of this forum
                              isveryloud@lemmy.caI This user is from outside of this forum
                              [email protected]
                              wrote on last edited by
                              #23

                              ...would JIT optimizations even help here?

                              1 Reply Last reply
                              1
                              • L [email protected]

                                As a shotgun. That's why people don't shoot themselves in the foot with a shotgun.

                                iavicenna@lemmy.worldI This user is from outside of this forum
                                iavicenna@lemmy.worldI This user is from outside of this forum
                                [email protected]
                                wrote last edited by
                                #24

                                Actually

                                https://neshobademocrat.com/stories/man-accidentally-shoots-his-foot-with-shotgun,121925

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups