Stories
Slash Boxes
Comments

SoylentNews is people

posted by janrinok on Friday September 23 2022, @11:35PM   Printer-friendly
from the leaks-are-for-kids dept.

Arthur T Knackerbracket has processed the following story:

Mark Russinovich, the chief technology office (CTO) of Microsoft Azure, says developers should avoid using C or C++ programming languages in new projects and instead use Rust because of security and reliability concerns.

Rust, which hit version 1.0 in 2020 and was born at Mozilla, is now being used within the Android Open Source Project (AOSP), at Meta, at Amazon Web Services, at Microsoft for parts of Windows and Azure, in the Linux kernel, and in many other places. 

Engineers value its "memory safety guarantees", which reduce the need to manually manage a program's memory and, in turn, cut the risk of memory-related security flaws burdening big projects written in "memory unsafe" C or C++, which includes Chrome, Android, the Linux kernel, and Windows. 

Microsoft drove home this point in 2019 after revealing 70% of its patches in the past 12 years were fixes for memory safety bugs due largely to Windows being written mostly in C and C++. Google's Chrome team weighed in with its own findings in 2020, revealing that 70% of all serious security bugs in the Chrome codebase were memory management and safety bugs. It's written mostly in C++.     

"Unless something odd happens, it [Rust] will make it into 6.1," wrote Torvalds, seemingly ending a long-running debate over Rust becoming a second language to C for the Linux kernel. 

The Azure CTO's only qualifier about using Rust is that it was preferable over C and C+ for new projects that require a non-garbage-collected (GC) language. GC engines handle memory management. Google's Go is a garbage-collection language, while the Rust project promotes that Rust is not. AWS engineers like Rust over Go because of the efficiencies it offers without GC.

"Speaking of languages, it's time to halt starting any new projects in C/C++ and use Rust for those scenarios where a non-GC language is required. For the sake of security and reliability. the industry should declare those languages as deprecated," Russinovich wrote. 

Rust is a promising replacement for C and C++, particularly for systems-level programming, infrastructure projects, embedded software development, and more – but not everywhere and not in all projects.  

[...] Rust shouldn't be viewed as a silver bullet for all the bad habits developers practice when coding in C or C++. 

Bob Rudis, a cybersecurity researcher for GreyNoise Intelligence, who was formerly with Rapid7, noted developers can carry across the same bad security habits to Rust.

"As others have said, you can write "safely" in C or C++, but it's much harder, no matter what dialect you use than it is in Rust. Mind you, you can still foul up security in Rust, but it does avoid a lot of old memory problems."


Original Submission

 
This discussion was created by janrinok (52) for logged-in users only, but now has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 3, Insightful) by acid andy on Saturday September 24 2022, @12:47PM (7 children)

    by acid andy (1683) on Saturday September 24 2022, @12:47PM (#1273371) Homepage Journal

    I just wish that C allowed references rather than pointers and using const rather than define, and a few other things that could be done without changing the language much.

    It would be nice to have but then why not just write procedural C++ so you can use those features to your heart's content?

    --
    If a cat has kittens, does a rat have rittens, a bat bittens and a mat mittens?
    Starting Score:    1  point
    Moderation   +1  
       Insightful=1, Total=1
    Extra 'Insightful' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   3  
  • (Score: 3, Insightful) by HiThere on Saturday September 24 2022, @01:13PM (6 children)

    by HiThere (866) Subscriber Badge on Saturday September 24 2022, @01:13PM (#1273375) Journal

    I do. But much of the rest of C++ is unneeded overhead, and a lot of people think I should be using them instead of "writing C code in C++".

    --
    Javascript is what you use to allow unknown third parties to run software you have no idea about on your computer.
    • (Score: 2) by turgid on Saturday September 24 2022, @05:50PM

      by turgid (4318) Subscriber Badge on Saturday September 24 2022, @05:50PM (#1273442) Journal

      Nobody expects the C++ inquisition!

    • (Score: 3, Funny) by sgleysti on Saturday September 24 2022, @08:55PM (4 children)

      by sgleysti (56) Subscriber Badge on Saturday September 24 2022, @08:55PM (#1273477)

      Don't listen to the haters. At my last job, they used a C++ compiler to compile what was otherwise pure C code just to get the // style comments permitted in C++. I'm not joking.

      • (Score: 2) by acid andy on Sunday September 25 2022, @06:34PM (3 children)

        by acid andy (1683) on Sunday September 25 2022, @06:34PM (#1273595) Homepage Journal

        On the one hand, life's far too short to be bothered about such things. On the other, it makes for a great anecdote on SN! =)

        --
        If a cat has kittens, does a rat have rittens, a bat bittens and a mat mittens?
        • (Score: 2) by sgleysti on Sunday September 25 2022, @07:37PM (2 children)

          by sgleysti (56) Subscriber Badge on Sunday September 25 2022, @07:37PM (#1273605)

          Oh, I found it simply amusing and was not bothered by it. My main point is to encourage HiThere to keep doing what he's doing: use the minimal features from C++ that help him out and leave it at that.

          • (Score: 2) by acid andy on Sunday September 25 2022, @09:02PM

            by acid andy (1683) on Sunday September 25 2022, @09:02PM (#1273627) Homepage Journal

            Got it, and agreed. This discussion has got me curious now to compare the output of the same source compiled as C versus C++ though. I'm not willing to just take the "haters" word for it that the C++ output will necessarily be more bloated or slower.

            --
            If a cat has kittens, does a rat have rittens, a bat bittens and a mat mittens?
          • (Score: 2) by coolgopher on Wednesday September 28 2022, @12:18AM

            by coolgopher (1157) on Wednesday September 28 2022, @12:18AM (#1273943)

            A colleague of mine is fond of using C++ on embedded devices purely for the template support. When needing to support different configuration sets of values for various sample-related things, templating on integers means that we can trade some flash space for performance. And in (really) tight ISRs that makes the difference between possible and impossible. Sometimes an indirection to load a boundary value is too expensive, and C++ templates can be an efficient way of solving that problem.