r/cpp • • Sep 20 '22

CTO of Azure declares C++ "deprecated"

https://twitter.com/markrussinovich/status/1571995117233504257
267 Upvotes

483 comments sorted by

View all comments

331

u/g9icy Sep 20 '22

The AAA games industry would beg to differ.

87

u/HateDread @BrodyHiggerson - Game Developer Sep 20 '22

Right? I better let everyone know so we can pivot every major engine and serious piece of tech.

0

u/[deleted] Sep 20 '22

[deleted]

7

u/megatesla Sep 20 '22

Have you worked with Haskell? I've been interested in learning functional programming, but I'm torn between Haskell and Scheme (specifically Guile).

32

u/lunareffect Sep 20 '22

Haskell is awesome and you will fall in love with it instantly. Functions flowing into functions all in perfect harmony. Then you reach the rude awakening of do blocks to get anything actually useful (i/o of any kind) done and everything falls apart. You then start programming imperatively in disguise of a functional language.

→ More replies (5)
→ More replies (1)
→ More replies (1)

43

u/insanitybit Sep 20 '22

He explicitly said new projects. He didn't advocate for porting existing code.

→ More replies (1)

7

u/Ameisen vemips, avr, rendering, systems Sep 20 '22

I just let my manager know that I would be instructing all teams to uninstall Visual C++, Clang, and GCC.

7

u/SkoomaDentist Antimodern C++, Embedded, Audio Sep 20 '22

Time to go back to Visual Basic 6.

11

u/ReDucTor Game Developer | quiz.cpp-perf.com Sep 20 '22

I'm down for the pivot, doesn't even have to be sponsored by Monster ;)

4

u/HateDread @BrodyHiggerson - Game Developer Sep 20 '22

Thanks JM ;)

39

u/ReDucTor Game Developer | quiz.cpp-perf.com Sep 20 '22

It's still early days, give it another 10 years I think that there might be hybrid rust/c++ code bases starting to come out more.

19

u/g9icy Sep 20 '22

Why though?

What would Rust do for us that C++ can't do?

78

u/pine_ary Sep 20 '22

It‘s more maintainable, easier to program for, has less unexpected behavior, has a more ergonomic typesystem, safe concurrency, and a better ecosystem of libraries (and in some cases tools).

Also C++ can‘t evolve like Rust can because of backwards compatibility, ABI, and the committee

47

u/g9icy Sep 20 '22

What are the trade offs though? What do we lose from using Rust?

It‘s more maintainable

Surely this can be a feature of the codebase itself, not just the language.

easier to program for

So what's the tradeoff here, what is lost to make it easier? What does "easier" mean?

has less unexpected behavior

How? I don't tend to have unexpected behaviour in C++ tbh

a better ecosystem of libraries

I find that hard to believe given how long C++ has been around.

Also C++ can‘t evolve like Rust can because of backwards compatibility, ABI, and the committee

Some might say that's a feature not a bug :D

I need to learn Rust to fully understand the benefits, but given nobody I know in the industry really cares or knows about it, I doubt there'll be a switch any time soon.

Maybe it'll be pushed by Unreal which might urge a switch over, but I just can't see it.

69

u/pine_ary Sep 20 '22 edited Sep 20 '22

I would say the tradeoff is development speed. Rust is slower to program. You can‘t just hack things together. But I would say that after getting into the Rust Mindset I‘ve been nearly on par with my C++ speed.

Easier means you need to hold less things in your head that have to do with the language while programming. In C++ you often have to carry around some mental list of "proper usages", possible pitfalls, or possible UB. In Rust: If it‘s not unsafe code, don‘t worry, the borrow checker and type system have your back. It also has less ways of achieving the same thing. There are no quadrillion subtly different initializations. There is no "did I accidentally copy this" confusion. There is no "use after move". There are more often canonical ways of achieving something. Rust also has proper mechanisms for what is template hacks in C++, there is no template hell in Rust.

18

u/g9icy Sep 20 '22

I see, thanks.

I need to spend a weekend researching this, it does sound promising.

At the moment my world is C++ or C# (for tools mostly) mostly focused on AAA dev. There’s no room for a new language on the platforms themselves, at least, not yet. As you say, time will tell.

39

u/pine_ary Sep 20 '22

I think the games industry will be the last to adopt Rust if it is to happen, simply by how incredibly averse the industry is to change. Major companies in the industry are still not on C++11 or use C++11 but write it like it‘s C with classes.

There are some promising developments tho. I think Unreal Engine has preliminary support for Rust now.

13

u/g9icy Sep 20 '22

Yep that's often the case. It's getting better, with adoption being faster.

Every company I've worked with over the last few years has supported C++20 or at minimum C++17 without issue. It depends on the platform, how recently the newest project was started, how much legacy code exists, etc.

9

u/ReDucTor Game Developer | quiz.cpp-perf.com Sep 20 '22

Your lucky, I know of AAA code bases which only just allowed support for range based for and lambdas in the last year (although they were creeping in before it was allowed by the standards).

→ More replies (0)
→ More replies (4)
→ More replies (1)

18

u/L0uisc Sep 20 '22

Rust forces you to write a maintainable code base more often. You can achieve that via coding standards in C++, but I think Rust is exploring valuable new avenues that C++ didn't do because it got stuck in a groove. It's good for C++ too, because it reinvigorates the imagination to push new boundaries of what's possible in systems language design, which is good for C++.

I really can't understand the "all in on one of the two languages" approach I see so often. Rust pushes C++ to do better, and C++ pushes Rust to add useful features (e.g. const generics, aka non-type template arguments). I'm all for both languages pushing the boundaries of what's possible to enforce at compile time in order to improve systems software, and healthy competition is a prerequisite for that.

→ More replies (1)

15

u/venustrapsflies Sep 20 '22

Rust should be great for game development because you will avoid nearly all memory bugs and the most difficult-to-track-down bugs, up front. But practically speaking a serious game dev isn't likely to choose it over C++ today because it's at least a decade behind in engine/library tech. (Except for like, roguelike hobby games and stuff like that)

→ More replies (4)
→ More replies (5)
→ More replies (24)
→ More replies (1)

16

u/Crax97 Sep 20 '22

In Rust's defense there are companies developing games/games tech in Rust, e.g Embark Studios

8

u/bilog78 Sep 20 '22

They should have written Rust (the game) in Rust (the language).

→ More replies (1)
→ More replies (32)