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
Code Project
  1. Home
  2. The Lounge
  3. Is C++ now a "safe" language?

Is C++ now a "safe" language?

Scheduled Pinned Locked Moved The Lounge
helpc++comfunctionalquestion
15 Posts 12 Posters 0 Views 1 Watching
  • 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.
  • S Offline
    S Offline
    swampwiz
    wrote on last edited by
    #1

    I was reading this article that said that we need to yank out C++ code from dangerous areas and rewrite them in Rust. One commenter mentioned that the newest C++ iteration fixes all the problems. Now I had "retired" back when auto_ptr was the hot new thing to take care of the deletion problem, and it seems that there are some new language features to fix the issues that auto_ptr introduced, and of course there is the whole new section of the language to give us the functional programming paradigm (I always like to use that word, LOL). That said, I suppose even with all the new features, it still is possible to blow one's foot off, something that Rust does not seem to allow oneself to do. https://techcrunch.com/2017/07/16/death-to-c/[^]

    L M K P S 8 Replies Last reply
    0
    • S swampwiz

      I was reading this article that said that we need to yank out C++ code from dangerous areas and rewrite them in Rust. One commenter mentioned that the newest C++ iteration fixes all the problems. Now I had "retired" back when auto_ptr was the hot new thing to take care of the deletion problem, and it seems that there are some new language features to fix the issues that auto_ptr introduced, and of course there is the whole new section of the language to give us the functional programming paradigm (I always like to use that word, LOL). That said, I suppose even with all the new features, it still is possible to blow one's foot off, something that Rust does not seem to allow oneself to do. https://techcrunch.com/2017/07/16/death-to-c/[^]

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      An article to cancel, only my mind ;)

      1 Reply Last reply
      0
      • S swampwiz

        I was reading this article that said that we need to yank out C++ code from dangerous areas and rewrite them in Rust. One commenter mentioned that the newest C++ iteration fixes all the problems. Now I had "retired" back when auto_ptr was the hot new thing to take care of the deletion problem, and it seems that there are some new language features to fix the issues that auto_ptr introduced, and of course there is the whole new section of the language to give us the functional programming paradigm (I always like to use that word, LOL). That said, I suppose even with all the new features, it still is possible to blow one's foot off, something that Rust does not seem to allow oneself to do. https://techcrunch.com/2017/07/16/death-to-c/[^]

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        If you follow good practice when designing your C++ code then your code will be safe. See :[C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines)

        I'd rather be phishing!

        J 1 Reply Last reply
        0
        • S swampwiz

          I was reading this article that said that we need to yank out C++ code from dangerous areas and rewrite them in Rust. One commenter mentioned that the newest C++ iteration fixes all the problems. Now I had "retired" back when auto_ptr was the hot new thing to take care of the deletion problem, and it seems that there are some new language features to fix the issues that auto_ptr introduced, and of course there is the whole new section of the language to give us the functional programming paradigm (I always like to use that word, LOL). That said, I suppose even with all the new features, it still is possible to blow one's foot off, something that Rust does not seem to allow oneself to do. https://techcrunch.com/2017/07/16/death-to-c/[^]

          K Offline
          K Offline
          Kaladin
          wrote on last edited by
          #4

          Modern C++ (C++11 and up) gives you ways to protect yourself, but it doesn't force you to use them. And even then, it just makes it harder, not impossible, to do stupid stuff. But that's true for any language.

          C 1 Reply Last reply
          0
          • M Maximilien

            If you follow good practice when designing your C++ code then your code will be safe. See :[C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines)

            I'd rather be phishing!

            J Offline
            J Offline
            Jeremy Falcon
            wrote on last edited by
            #5

            I mean seriously... what does Bjarne know!?

            Jeremy Falcon

            1 Reply Last reply
            0
            • S swampwiz

              I was reading this article that said that we need to yank out C++ code from dangerous areas and rewrite them in Rust. One commenter mentioned that the newest C++ iteration fixes all the problems. Now I had "retired" back when auto_ptr was the hot new thing to take care of the deletion problem, and it seems that there are some new language features to fix the issues that auto_ptr introduced, and of course there is the whole new section of the language to give us the functional programming paradigm (I always like to use that word, LOL). That said, I suppose even with all the new features, it still is possible to blow one's foot off, something that Rust does not seem to allow oneself to do. https://techcrunch.com/2017/07/16/death-to-c/[^]

              P Offline
              P Offline
              Paulo Zemek
              wrote on last edited by
              #6

              C++ is far from a safe language. Specially if you need to deal with many DLLs, maybe compiled by different C++ compilers. Most of the safety features of C++ are only safe in the context of a single binary or maybe different binaries built by the same compiler. In fact templates in general (used by all kinds of "safe pointers") suffer a lot of optimizations that may break across binaries. So, is it safe now? Well, it has much more safety features than in the past. But those are not 100% guaranteed in all scenarios and, well, you can ignore them at any time.

              1 Reply Last reply
              0
              • K Kaladin

                Modern C++ (C++11 and up) gives you ways to protect yourself, but it doesn't force you to use them. And even then, it just makes it harder, not impossible, to do stupid stuff. But that's true for any language.

                C Offline
                C Offline
                CodeWraith
                wrote on last edited by
                #7

                And that's good. Otherwise the language would be slow and too restricted to be of any use.

                Richard Andrew x64R 1 Reply Last reply
                0
                • S swampwiz

                  I was reading this article that said that we need to yank out C++ code from dangerous areas and rewrite them in Rust. One commenter mentioned that the newest C++ iteration fixes all the problems. Now I had "retired" back when auto_ptr was the hot new thing to take care of the deletion problem, and it seems that there are some new language features to fix the issues that auto_ptr introduced, and of course there is the whole new section of the language to give us the functional programming paradigm (I always like to use that word, LOL). That said, I suppose even with all the new features, it still is possible to blow one's foot off, something that Rust does not seem to allow oneself to do. https://techcrunch.com/2017/07/16/death-to-c/[^]

                  S Offline
                  S Offline
                  Single Step Debugger
                  wrote on last edited by
                  #8

                  Avoiding smart pointers and third party fancy stuff, should do the trick. And most of the critical applications runs on embedded systems, that have their own simplified, hardware specific compilers.

                  There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                  1 Reply Last reply
                  0
                  • S swampwiz

                    I was reading this article that said that we need to yank out C++ code from dangerous areas and rewrite them in Rust. One commenter mentioned that the newest C++ iteration fixes all the problems. Now I had "retired" back when auto_ptr was the hot new thing to take care of the deletion problem, and it seems that there are some new language features to fix the issues that auto_ptr introduced, and of course there is the whole new section of the language to give us the functional programming paradigm (I always like to use that word, LOL). That said, I suppose even with all the new features, it still is possible to blow one's foot off, something that Rust does not seem to allow oneself to do. https://techcrunch.com/2017/07/16/death-to-c/[^]

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    You can blow your foot off with Rust too, but it's a bit more explicit.

                    1 Reply Last reply
                    0
                    • C CodeWraith

                      And that's good. Otherwise the language would be slow and too restricted to be of any use.

                      Richard Andrew x64R Offline
                      Richard Andrew x64R Offline
                      Richard Andrew x64
                      wrote on last edited by
                      #10

                      You mean like managed languages? :-D

                      The difficult we do right away... ...the impossible takes slightly longer.

                      C 1 Reply Last reply
                      0
                      • Richard Andrew x64R Richard Andrew x64

                        You mean like managed languages? :-D

                        The difficult we do right away... ...the impossible takes slightly longer.

                        C Offline
                        C Offline
                        CodeWraith
                        wrote on last edited by
                        #11

                        Yes. The worst thing is that some people don't really know what they are doing anymore and turned ignorance into a matter of faith. I have seen guys who were unable to find a memory leak that forced the server to be reset every day. Instead of finding the leak, they insisted on not managing memory and tried to bat the garbage collector into submission. I perfer C++, because it let's you do what you want and therefore also leaves you with the responsibility. When something goes wrong, it's time to use your head and not to recite religious beliefs.

                        J S 2 Replies Last reply
                        0
                        • S swampwiz

                          I was reading this article that said that we need to yank out C++ code from dangerous areas and rewrite them in Rust. One commenter mentioned that the newest C++ iteration fixes all the problems. Now I had "retired" back when auto_ptr was the hot new thing to take care of the deletion problem, and it seems that there are some new language features to fix the issues that auto_ptr introduced, and of course there is the whole new section of the language to give us the functional programming paradigm (I always like to use that word, LOL). That said, I suppose even with all the new features, it still is possible to blow one's foot off, something that Rust does not seem to allow oneself to do. https://techcrunch.com/2017/07/16/death-to-c/[^]

                          K Offline
                          K Offline
                          KarstenK
                          wrote on last edited by
                          #12

                          I dont like "safe" languages, because all safety features are brakes. C++ is dangerous and thats why faster than the rest. :rolleyes:

                          Press F1 for help or google it. Greetings from Germany

                          1 Reply Last reply
                          0
                          • C CodeWraith

                            Yes. The worst thing is that some people don't really know what they are doing anymore and turned ignorance into a matter of faith. I have seen guys who were unable to find a memory leak that forced the server to be reset every day. Instead of finding the leak, they insisted on not managing memory and tried to bat the garbage collector into submission. I perfer C++, because it let's you do what you want and therefore also leaves you with the responsibility. When something goes wrong, it's time to use your head and not to recite religious beliefs.

                            J Offline
                            J Offline
                            jschell
                            wrote on last edited by
                            #13

                            Last project I worked on had 250 meg in the source control repository. The 'performance' problems I encountered were all due to poor design and architecture decisions. Not mine. Best I can suppose it that they were based on ignorance, fantasy and whim. And some of that isn't conjecture when people actually admitted that they did it wrong or did it just to try something new. I am very thankful that I didn't also need to track down memory leaks.

                            1 Reply Last reply
                            0
                            • S swampwiz

                              I was reading this article that said that we need to yank out C++ code from dangerous areas and rewrite them in Rust. One commenter mentioned that the newest C++ iteration fixes all the problems. Now I had "retired" back when auto_ptr was the hot new thing to take care of the deletion problem, and it seems that there are some new language features to fix the issues that auto_ptr introduced, and of course there is the whole new section of the language to give us the functional programming paradigm (I always like to use that word, LOL). That said, I suppose even with all the new features, it still is possible to blow one's foot off, something that Rust does not seem to allow oneself to do. https://techcrunch.com/2017/07/16/death-to-c/[^]

                              P Offline
                              P Offline
                              PIEBALDconsult
                              wrote on last edited by
                              #14

                              I like C and C#, but I never really cared for C++. However, I wish C# were more like C++ -- multi-paradigm and multiple-inheritance. In my opinion, they made C# too much like VB and not enough like C++. I don't actually do much that requires OOP, so I find C# forcing me to define a class rather irksome.

                              1 Reply Last reply
                              0
                              • C CodeWraith

                                Yes. The worst thing is that some people don't really know what they are doing anymore and turned ignorance into a matter of faith. I have seen guys who were unable to find a memory leak that forced the server to be reset every day. Instead of finding the leak, they insisted on not managing memory and tried to bat the garbage collector into submission. I perfer C++, because it let's you do what you want and therefore also leaves you with the responsibility. When something goes wrong, it's time to use your head and not to recite religious beliefs.

                                S Offline
                                S Offline
                                swampwiz
                                wrote on last edited by
                                #15

                                I've also seen projects go to crawl trying to locate the memory leak. Every time, it was proven that the 3rd party library was to blame.

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


                                • Login

                                • Don't have an account? Register

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