Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • 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. average c++ dev

average c++ dev

Scheduled Pinned Locked Moved Programmer Humor
programmerhumor
116 Posts 63 Posters 5 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.
  • anyoldname3@lemmy.worldA [email protected]

    Soldiers are supposed to question potentially-illegal orders and refuse to execute them if their commanding officer can't give a good reason why they're justified. Being in charge doesn't mean you're infallible, and there are plenty of mistakes programmers make that the compiler can detect.

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

    I get the analogy, but I don't think that it's valid. Soldiers are, much to the chagrin of their commanders, sentient beings, and should question potentially illegal orders.

    Where the analogy doesn't hold is, besides my computer not being sentient, what I'm prevented from doing isn't against the law of man.

    I'm not claiming to be infallible. After all to err is human, and I'm indeed very human. But throw me a warning when I do something that goes against best practices, that's fine. Whether I deal with it is something for me to decide. But stopping me from doing what I'm trying to do, because it's potentially problematic? GTFO with that kinda BS.

    1 Reply Last reply
    2
    • buboscandiacus@mander.xyzB [email protected]

      Ok gramps now take your meds and off you go to the retirement home

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

      Stupid cloud, who's laughing now?

      1 Reply Last reply
      2
      • danhab99@programming.devD [email protected]

        I don't think that casting a range of bits as some other arbitrary type "is a bug nobody sees coming".

        C++ compilers also warn you that this is likely an issue and will fail to compile if configured to do so. But it will let you do it if you really want to.

        That's why I love C++

        merc@sh.itjust.worksM This user is from outside of this forum
        merc@sh.itjust.worksM This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #43

        "C++ compilers also warn you..."

        Ok, quick question here for people who work in C++ with other people (not personal projects). How many warnings does the code produce when it's compiled?

        I've written a little bit of C++ decades ago, and since then I've worked alongside devs who worked on C++ projects. I've never seen a codebase that didn't produce hundreds if not thousands of lines of warnings when compiling.

        J V S W zacryon@feddit.orgZ 11 Replies Last reply
        40
        • merc@sh.itjust.worksM This user is from outside of this forum
          merc@sh.itjust.worksM This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #44

          Not only that, but everyone who sees that code later is going to waste so much time trying to understand it. That includes future you.

          zacryon@feddit.orgZ 1 Reply Last reply
          5
          • B [email protected]

            But it will let you do it if you really want to.

            Now, I've seen this a couple of times in this post. The idea that the compiler will let you do anything is so bizarre to me. It's not a matter of being allowed by the software to do anything. The software will do what you goddamn tell it to do, or it gets replaced.

            WE'RE the humans, we're not asking some silicon diodes for permission. What the actual fuck?!? We created the fucking thing to do our bidding, and now we're all oh pwueez mr computer sir, may I have another ADC EAX, R13? FUCK THAT! Either the computer performs like the tool it is, or it goes the way of broken hammers and lawnmowers!

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

            This comment makes me want to reformat every fucking thing i use and bend it to -my- will like some sort of technomancer

            1 Reply Last reply
            0
            • merc@sh.itjust.worksM [email protected]

              "C++ compilers also warn you..."

              Ok, quick question here for people who work in C++ with other people (not personal projects). How many warnings does the code produce when it's compiled?

              I've written a little bit of C++ decades ago, and since then I've worked alongside devs who worked on C++ projects. I've never seen a codebase that didn't produce hundreds if not thousands of lines of warnings when compiling.

              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
              #46

              You shouldn't have any warnings. They can be totally benign, but when you get used to seeing warnings, you will not see the one that does matter.

              merc@sh.itjust.worksM 1 Reply Last reply
              15
              • danhab99@programming.devD [email protected]

                I don't think that casting a range of bits as some other arbitrary type "is a bug nobody sees coming".

                C++ compilers also warn you that this is likely an issue and will fail to compile if configured to do so. But it will let you do it if you really want to.

                That's why I love C++

                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
                #47

                As it should be. Airbags should go off when you crash, not when you drive near the edge of a cliff.

                1 Reply Last reply
                12
                • merc@sh.itjust.worksM [email protected]

                  "C++ compilers also warn you..."

                  Ok, quick question here for people who work in C++ with other people (not personal projects). How many warnings does the code produce when it's compiled?

                  I've written a little bit of C++ decades ago, and since then I've worked alongside devs who worked on C++ projects. I've never seen a codebase that didn't produce hundreds if not thousands of lines of warnings when compiling.

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

                  Ignoring warnings is really not a good way to deal with it. If a compiler is bitching about something there is a reason to.

                  A lot of times the devs are too overworked or a little underloaded in the supply of fucks to give, so they ignore them.

                  In some really high quality codebases, they turn on "treat warnings as errors" to ensure better code.

                  merc@sh.itjust.worksM 1 Reply Last reply
                  2
                  • merc@sh.itjust.worksM [email protected]

                    "C++ compilers also warn you..."

                    Ok, quick question here for people who work in C++ with other people (not personal projects). How many warnings does the code produce when it's compiled?

                    I've written a little bit of C++ decades ago, and since then I've worked alongside devs who worked on C++ projects. I've never seen a codebase that didn't produce hundreds if not thousands of lines of warnings when compiling.

                    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 [email protected]
                    #49

                    Depends on the age of the codebase, the age of the compiler and the culture of the team.

                    I’ve arrived into a team with 1000+ warnings, no const correctness (code had been ported from a C codebase) and nothing but C style casts. Within 6 months, we had it all cleaned up but my least favourite memory from that time was “I’ll just make this const correct; ah, right, and then this; and now I have to do this” etc etc. A right pain.

                    merc@sh.itjust.worksM 1 Reply Last reply
                    2
                    • W [email protected]

                      Safe in what regards? You're being cagey on purpose. In terms of memory there is a guarantee that Rust is automatically safer than c++, period. Im business Logic? Sure you're right

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

                      No there is not. Borrow checking and RAII existed in C++ too and there is no formal axiomatic proof of their safety in a general sense. Only to a very clearly defined degree.

                      In fact, someone found memory bugs in Rust, again, because it is NOT soundly memory safe.

                      Dart is soundly Null-safe. Meaning it can never mathematically compile null unsafe code unless you explicitly say you're OK with it. Kotlin is simply Null safe, meaning it can run into bullshit null conditions.

                      The same thing with Rust: don't let it lull you into a sense of security that doesn't exist.

                      B 1 Reply Last reply
                      0
                      • W [email protected]

                        My issue is C++ will "let me do it", and by that I mean "you didn't cast here (which is UB), so I will optimize out a null check later, and then segfault in a random location"

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

                        Always check your programs on -O0 or pay the price

                        Shit gets really fun when you find out your code is a edge case for compiler optimization and should never be optimized away (although this is very very rare for -O2)

                        1 Reply Last reply
                        4
                        • korne127@lemmy.worldK [email protected]

                          But does it have cargo-mommy 😛

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

                          TIL there's more than one kind of "vibe" coding.

                          1 Reply Last reply
                          4
                          • korne127@lemmy.worldK [email protected]

                            But does it have cargo-mommy 😛

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

                            1 Reply Last reply
                            3
                            • P [email protected]

                              I actually do like that C/C++ let you do this stuff.

                              Sometimes it's nice to acknowledge that I'm writing software for a computer and it's all just bytes. Sometimes I don't really want to wrestle with the ivory tower of abstract type theory mixed with vague compiler errors, I just want to allocate a block of memory and apply a minimal set rules on top.

                              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]
                              #54

                              100%. In my opinion, the whole "build your program around your model of the world" mantra has caused more harm than good. Lots of "best practices" seem to be accepted without any quantitative measurement to prove it's actually better. I want to think it's just the growing pains of a young field.

                              spacecowboy@lemmy.caS 1 Reply Last reply
                              3
                              • J [email protected]

                                You shouldn't have any warnings. They can be totally benign, but when you get used to seeing warnings, you will not see the one that does matter.

                                merc@sh.itjust.worksM This user is from outside of this forum
                                merc@sh.itjust.worksM This user is from outside of this forum
                                [email protected]
                                wrote on last edited by
                                #55

                                I know, that's why it bothered me that it seemed to be "policy" to just ignore them.

                                1 Reply Last reply
                                4
                                • V [email protected]

                                  Ignoring warnings is really not a good way to deal with it. If a compiler is bitching about something there is a reason to.

                                  A lot of times the devs are too overworked or a little underloaded in the supply of fucks to give, so they ignore them.

                                  In some really high quality codebases, they turn on "treat warnings as errors" to ensure better code.

                                  merc@sh.itjust.worksM This user is from outside of this forum
                                  merc@sh.itjust.worksM This user is from outside of this forum
                                  [email protected]
                                  wrote on last edited by
                                  #56

                                  I know that should be the philosophy, but is it? In my experience it seems to be normal to ignore warnings.

                                  1 Reply Last reply
                                  0
                                  • S [email protected]

                                    Depends on the age of the codebase, the age of the compiler and the culture of the team.

                                    I’ve arrived into a team with 1000+ warnings, no const correctness (code had been ported from a C codebase) and nothing but C style casts. Within 6 months, we had it all cleaned up but my least favourite memory from that time was “I’ll just make this const correct; ah, right, and then this; and now I have to do this” etc etc. A right pain.

                                    merc@sh.itjust.worksM This user is from outside of this forum
                                    merc@sh.itjust.worksM This user is from outside of this forum
                                    [email protected]
                                    wrote on last edited by
                                    #57

                                    So, did you get it down to 0 warnings and manage to keep it there? Or did it eventually start creeping up again?

                                    S S 2 Replies Last reply
                                    1
                                    • merc@sh.itjust.worksM [email protected]

                                      "C++ compilers also warn you..."

                                      Ok, quick question here for people who work in C++ with other people (not personal projects). How many warnings does the code produce when it's compiled?

                                      I've written a little bit of C++ decades ago, and since then I've worked alongside devs who worked on C++ projects. I've never seen a codebase that didn't produce hundreds if not thousands of lines of warnings when compiling.

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

                                      None. We treat warnings as compiler errors with a compiler flag

                                      1 Reply Last reply
                                      6
                                      • merc@sh.itjust.worksM [email protected]

                                        "C++ compilers also warn you..."

                                        Ok, quick question here for people who work in C++ with other people (not personal projects). How many warnings does the code produce when it's compiled?

                                        I've written a little bit of C++ decades ago, and since then I've worked alongside devs who worked on C++ projects. I've never seen a codebase that didn't produce hundreds if not thousands of lines of warnings when compiling.

                                        zacryon@feddit.orgZ This user is from outside of this forum
                                        zacryon@feddit.orgZ This user is from outside of this forum
                                        [email protected]
                                        wrote on last edited by
                                        #59

                                        I mostly see warnings when compiling source code of other projects. If you get a warning as a dev, it's your responsibility to deal with it. But also your risk, if you don't. I made it a habit to fix every warning in my own projects. For prototyping I might ignore them temporarily. Some types of warnings are unavoidable sometimes.

                                        If you want to make yourself not ignore warnings, you can compile with -Werror if using GCC/G++ to make the compiler a pedantic asshole that doesn't compile until you fix every fucking warning. Not advisable for drafting code, but definitely if you want to ship it.

                                        V 1 Reply Last reply
                                        23
                                        • U [email protected]

                                          I used to love C++ until I learned Rust. Now I think it is obnoxious, because even if you write modern C++, without raw pointers, casting and the like, you will be constantly questioning whether you do stuff right. The spec is just way too complicated at this point and it can only get worse, unless they choose to break backwards compatibility and throw out the pre C++11 bullshit

                                          zacryon@feddit.orgZ This user is from outside of this forum
                                          zacryon@feddit.orgZ This user is from outside of this forum
                                          [email protected]
                                          wrote on last edited by
                                          #60

                                          I suppose it's a matter of experience and practise. The more you wotk with it the better you get. As usual with all things one can learn.

                                          S 1 Reply Last reply
                                          1
                                          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