r/programming • • Feb 18 '20

C++20 is here!

https://youtu.be/AvPiGstxV_g
89 Upvotes

122 comments sorted by

38

u/[deleted] Feb 18 '20

I'm really curious about where C++ goes. It just becomes less similar to C every new standard.

3

u/G_Morgan Feb 19 '20

New C++ is really good. If they could magically transpose all existing C++ code into new C++ it would likely see a big bump in popularity. However we've yet to invent magic.

7

u/shevy-ruby Feb 18 '20

Yeah but ...

.. they still keep backwards behaviour.

To be honest, I think it is good if people finally realize that C holds us down too. I am just not sure whether C++ is the answer ..

8

u/[deleted] Feb 18 '20

I think the letter C holds us down in general. Why not create a good language named E?

6

u/[deleted] Feb 19 '20

I think the letter C holds us down in general.

That whole "C" pedigree never stopped objective-C from becoming a syntactical abomination.

Don't let your dreams be dreams

0

u/[deleted] Feb 18 '20

[deleted]

19

u/GerwazyMiod Feb 18 '20

Clang-tidy is now more or less a standard linter.

9

u/falconfetus8 Feb 19 '20

What features of modern C++ are you using that you like better than the other languages?

-5

u/the_evergrowing_fool Feb 19 '20

Is not safe by default.

10

u/falconfetus8 Feb 19 '20

And that makes you like it...better?

11

u/the_evergrowing_fool Feb 19 '20

Yes. No need to go through hoops to manipulate memory.

0

u/HappyParallelepiped Feb 20 '20

Boy do I have a language for you, and even better, it's a close relative of C++.

3

u/the_evergrowing_fool Feb 20 '20

Nah. I like RAII too much.

5

u/NotMyRealNameObv Feb 19 '20

The only challenge I view is maintaining code quality when a lot of new devs try to contribute, so I need to look into static analysis tools a bit more before presenting my final proposal.

Compile with at least 2 compilers (e.g. GCC and Clang) with warnings cranked up and treat warnings as errors, use Clang-analyze, Clang-tidy, run tests under ASAN, TSAN, UBSAN, Valgrind. If you talk to untrusted peers, use Clang's Libfuzzer.

5

u/[deleted] Feb 19 '20

I would try to integrate some third party C++ libraries (Boost, Protobuf, etc.) into your build system before you consign a future generation of programmers to CMake hell.

Seriously, for all of Rust's improved syntax and safety, one of the best features is that I don't have to use CMake. And autotools. And GNU Make. And b2. And ....

4

u/jl2352 Feb 19 '20

I don’t think Rust or C++ will really matter.

However you are playing with fire by trying to ignore your entire teams recommendation. I’ve seen that happen, and without a strong compelling reason it’s really bad to do.

0

u/[deleted] Feb 19 '20

[deleted]

1

u/jl2352 Feb 19 '20

That is good to hear. I mistook how you had described it.

9

u/[deleted] Feb 18 '20

Username checks out lol. I still prefer C tho

0

u/[deleted] Feb 18 '20

[deleted]

26

u/[deleted] Feb 18 '20

You don't understand why somebody might prefer rust so that they don't have to "to look into static analysis tools" to "maintain code quality when a lot of new devs try to contribute"?

0

u/[deleted] Feb 18 '20

[deleted]

31

u/epicwisdom Feb 19 '20

I feel like comparing a simple text search for unsafe to the extremely complex and ultimately imperfect static analysis tools for C++ is disingenuous.

36

u/zerakun Feb 18 '20 edited Feb 18 '20

I find the fact that you're calling rust a "moving target" and praising modern C++'s maturity a bit ironic when commenting on a post that presents huge new c++ features that deeply change the compilation model (concepts, modules) or a huge concept from the standard library (ranges).

This might look like a bold statement, but IMO there has been more changes to C++ than to rust since 2015 which marked rust 1.0 (C++17 brought std::optional and std::variant that are very huge change to the way one should write typical C++, for instance). It is also not over, what with the current discussions on destructive move, or the exception model (where basically the plan is to switch to something that looks like rust's result), or the poor man's lifetime checker that is in the work.

The C++ stability guarantee may mean that code written today should still work in future versions, but rust also provides this guarantee, and it is for sure that "modern" C++ in three years will look very different than it is today.

IMO there is very little justification for favoring C++ over rust for new projects. It could be justified if the ecosystem of the project is very skewed towards C++ already, like maybe when doing GUI (qt is unmatched at the moment), but otherwise I'd be hard to convince. Better invest these 4 weeks to learn the langage than lose then promptly in debugging UB.

5

u/D_0b Feb 19 '20

Just a curious question, ( not attacking anyone )

why do you say a poor man's lifetime checker? From what I have read/understood it has pretty much the same capabilities?

Any example where Rust can save you, but not with the proposed C++ lifetime profiler?

8

u/steveklabnik1 Feb 19 '20

Even the folks who are authoring the proposed C++ papers have said, from the beginning, that they're not shooting for equivalence with Rust.

The current paper, for example, says:

> We do not attempt to address all aliasing cases or make concurrency safety guarantees.

3

u/dreugeworst Feb 19 '20

Not GP, but the plans for the c++ lifetime checker only include checking lifetimes within a single function. lifetimes across function calls or of references held in structs are not checked

3

u/D_0b Feb 19 '20

can you give a quick example, where the C++ checker would fail?

→ More replies (0)

3

u/MonokelPinguin Feb 19 '20

I'd say C++20 is the first major change since C++11. Sure, there were some cool new features here and there, but they only improved minor annoyances than change major things, that everyone relied on. (You could say, guaranteed copy elision changed something everyone relied one, but in most cases it just made existing code better without breaking anything, etc.)

Rust changed a lot more in that timeframe. I'd even say, none knew about Rust in 2011. Also Rust moves a lot faster, there are major changes every few months, C++ brings them every 3 years and compilers release on somewhat a yearly cadence, so you need to deal with changes a lot less often. Especially with async now being stabilized, there are still a lot of libraries, that depend on nightly or didn't see a stable release yet.

This makes Rust a target I don't want to rely on yet for a big project, that I expect to maintain for the next 10 years. Rust has a lot of benefits, but it is still a bit young and unstable.

-3

u/saltybandana2 Feb 18 '20 edited Feb 19 '20

C++ is going to maintain backwards compatibility, which makes your point moot.


edit: not getting into it with yet another zealot. I commented on C++, not rust, because you were being unfair to C++. But you took even that as me talking about rust. enough so that you felt the need to respond as if I had attacked rust.

This is why people don't invite you places.

11

u/epicwisdom Feb 19 '20

As will Rust. You're ignoring the nuances of the points being made.

3

u/tsimionescu Feb 19 '20

The point is that the original complaint was "Rust is too much of a moving target, whereas C++ is not". Both C++ and Rust are committed to backwards compatibility, so there is no point in comparing them here. However, C++, according to the GP, is changing more than Rust, so the original assertion makes no point (according to GP).

2

u/saltybandana2 Feb 19 '20

yeah, how dare anyone insinuate that a young language changes faster than an old language. Such an unreasonable thought.

I think the part that cracks me up the most is that some of the features coming out in C++ have been worked on for almost as long as rust has existed.

Everyone outside the rust community understands what's really going on here. Someone spoke ill of rust and that just invites the nutters.

"the real point is that C++ changes more than rust!". yeah ok, now be a good child and get to bed.

0

u/[deleted] Feb 18 '20

[deleted]

5

u/matthieum Feb 19 '20

like maybe when doing GUI And embedded. And games. And finance. And HPC. And GPGPU... For new projects that are more or less self-contained, you are right: Rust is a good choice. For many other fields and projects, not so much.

I think that's an important point. I'd pick Rust over C++ anytime I don't need major libraries/frameworks from the outside.

If I planned a project that "builds on the shoulders of giants", I'd want to be able to lean on the ecosystem, and no build the giants myself as that would defeat the purpose.

Now, sometimes the giants exist in C, and it can be easy enough to write a Rust wrapper on top -- however if the invariants are tricky, lifetimes complex, etc... it may be easier to just use a mature C++ dependency. Easier, at least, after the initial pain for integrating with it.

4

u/[deleted] Feb 18 '20

Maturity is a good point and it certainly could be too immature for your needs.

Is grep really "static analysis" though?

4

u/saltybandana2 Feb 18 '20

pretending that grep is enough is why lots of people don't care for the rust community.

13

u/epicwisdom Feb 19 '20

It's specifically a response to the use of unsafe. One of the major advantages of having the unsafe keyword is being able to just grep it.

-1

u/saltybandana2 Feb 19 '20

No, the major advantage of the unsafe keyword is tooling, which the rust community has completely missed the boat on. Presumably because they can't look past grep.

→ More replies (0)

-5

u/[deleted] Feb 18 '20

Yeah totally right. At the end of the day it boils down to what you need to accomplish, not what you prefer.

C for bits, C++ for objects, rust for loss of hair, python for slow killing venom etc. I still don't know what D does better tho.

2

u/[deleted] Feb 19 '20

I still don't know what D does better tho.

Nearly everything, from the code perspective. D's ranges in particular are absolutely sick.

-4

u/flatfinger Feb 18 '20

C89 makes it possible to write "freestanding functions" which can be run as blobs of code which are largely agnostic to most traits of the calling environment other than its instruction set, the availability of stack space, and the parameters that the caller places on the stack. Although the Standard mandates that implementations support modifiable static-duration objects, C functions that don't need any modifiable static-duration objects can be run within environments that can't support them (e.g. "plug-ins" for use within certain applications). The design of C++ is far less friendly toward such environments; I know of no implementations that would contain the "hooks" necessary to work within them.

0

u/[deleted] Feb 19 '20

[deleted]

1

u/flatfinger Feb 19 '20

What hooks do those C++ implementations offer to work in environments that can't support modifiable static objects? A C implementation wouldn't need any static objects if a program doesn't declare any, but I would think a C++ would need some static objects to keep track of things like the current memory allocation function unless one foregoes anything that would directly or indirectly make use of `new`.

0

u/[deleted] Feb 19 '20

[deleted]

2

u/flatfinger Feb 19 '20

It's certainly possible to "write C in C++", and I've done it (though that was about 10 years ago). I was under the impression that under later versions of the Standard, new chained to an allocator which could be configured at run-time, which would seem to require the existence of a thread-static place to keep track of which allocator should be called. It's possible that my misapprehensions of C++ are misplaced, and if at times I appear argumentative, it's because my life philosophy is that one learns more from being wrong than by being right, and because questions on the Internet get far fewer responses than wrong claims.

I do think both C and C++ would benefit from recognizing optional behavioral models that would offer stronger guarantees than would otherwise be mandated. My philosophy is that if a non-optimizing compiler for a particular platform would have to go out of its way not to process some particular construct with semantics that would sometimes be useful, the language should not make it difficult for a programmer to write code with such semantics, with the caveat that implementations that can't handle the semantics would be forbidden from behaving in worse-than-useless fashion. Refusing to compile the program altogether would be considered "useless" [but not "worse than useless"]; a programmer may specify other acceptable behaviors. Adding such abilities to the language would make it possible to safely and automatically test programs for compatibility with implementations by simply trying to process them, as opposed to requiring that people wishing to use the code examine the human-readable descriptions of what semantic guarantees the code requires and how to enable such semantics in the compiler.

Going beyond that, I'd like to see the Standards recognize the critical distinction between "useless" and "worse-than-useless" behavior. Many programs are subject to the constraints that when given valid inputs and adequate resources, they should behave usefully, but what is more important is that their behavior must always stay within certain fairly broad limits even when they cannot behave usefully. Allowing programmers to identify situations where execution may be regarded as "useless", and specify what actions would or would not be acceptable in such cases, would give optimizers to practically exercise more freedom than would be practical today outside of niche applications which either (1) are guaranteed never to receive maliciously-crafted data, or (2) are only run in contexts where, even if they were malicious, they couldn't do anything that was unacceptably bad.

1

u/atilaneves Feb 19 '20

Out of curiosity, why C++ over D?

0

u/[deleted] Feb 18 '20

[deleted]

7

u/CoffeeTableEspresso Feb 18 '20 edited Feb 19 '20

Someone should make Nim++. It's like Nim, but with templates and classes and a bunch of nice features like that. It's such a good idea I'm not sure why someone hasn't done it yet..

EDIT: really didnt think I need to put a /s here ...

8

u/elder_george Feb 18 '20

Doesn't Nim already have all of those?

1

u/CoffeeTableEspresso Feb 18 '20

Yes. I'm more making fun of C++ than anything here...

1

u/irqlnotdispatchlevel Feb 19 '20

Nim now compiles to c++ so... job done?

-2

u/defunkydrummer Feb 19 '20

Someone should make Nim++. It's like Nim, but with templates and classes and a bunch of nice features like that. It's such a good idea I'm not sure why someone hasn't done it yet..

That would make it Common Lisp.

34

u/[deleted] Feb 18 '20 edited Feb 19 '20

Thought this was going to be about C++20 features.

8

u/G01denW01f11 Feb 19 '20

I'd better hurry and study up on this so I'm ready when we're allowed to use it at work in another 10 years.

33

u/shevy-ruby Feb 18 '20

Big surprise!

C++ is now more complex than before!!! \o/

(It's not totally fair; some changes were good. But still ...)

26

u/setuid_w00t Feb 18 '20

C++ proponents: "It's actually simpler because [insert new feature here] makes it easier to do [insert thing here] relative to [insert classic c++ foot-gun here]."

In reality, it just means that now everyone has to understand two ways do to [insert thing here] instead of one.

33

u/meneldal2 Feb 19 '20

The way it goes is:

  • Feature is missing

  • Templates are abused again to make it possible

  • It's a big mess.

  • ???

  • People finally get a sane way to do it in the standard

  • Template insanity doesn't leave.

8

u/Necessary-Space Feb 19 '20

Template insanity gets adopted as the standard.

26

u/NotUniqueOrSpecial Feb 19 '20

it just means that now everyone has to understand two ways do to [insert thing here] instead of one.

God forbid they try to improve the way things are done in such a way as to make it easier to do the right thing.

I don't ever hear people complaining about things like this in other languages, e.g. with Python added format-strings.

8

u/[deleted] Feb 19 '20

This happens with every language though. Code reflects the time in which it was written.

What actually matters is whether the cruft of old persists to the code of the future. It is undeniable that C++ has taken major strides to provide a more modern and sensible language that addresses the widely-documented shortcomings of its predecessors.

3

u/setuid_w00t Feb 19 '20

The one necessary step that c++ hasn't taken is removing old mistakes and thus the language just keeps getting bigger and more complicated.

7

u/corysama Feb 19 '20

Has any mainstream language ever removed features?

Here’s one: Python removed the print statement in favor of the print() function and that led to people waiting over ten years to upgrade their existing code. Python 2 is officially unsupported as of April and there are major packages out there being widely used that still can’t run on 3.

4

u/save_vs_death Feb 19 '20

if you think that whole thing was over the print statement I don't know what to tell you

you larger point indeed stands, people don't like it when you're perceived as removing features; for all intents and purposes, unless you're Swift, you're not gonna get away with backwards incompatible changes, so once you release a feature it's out for good

1

u/Nobody_1707 Feb 20 '20

Are we counting gets or implicit int?

4

u/leirus Feb 18 '20

you need to forget the obsolete way and move on to modern way, simple xD

6

u/setuid_w00t Feb 19 '20

You can't forget the old way because there are millions of lines of code out there that do it the old way and you need to read and understand that code.

1

u/Ivan171 Feb 19 '20

You know you can still use [insert thing here] instead of [insert new feature here] right?

Because of backward compatibility they almost never remove old features.

3

u/AdamRGrey Feb 18 '20

Alright. Cool. So excited. I learned C++98 back in 2007, pretty sure I forgot everything. Should I start from scratch, or look for incremental upgrade tutorials?

21

u/Splanky222 Feb 18 '20

C++11 was the biggest language change. Everything from then on builds on top of it.

10

u/elder_george Feb 18 '20

the "Tour of C++" 2nd ed. is pretty concise and gives a good outline of C++17 (I think). You can upgrade on top of that.

3

u/pure_x01 Feb 18 '20

What are the top 3 festures? Great news btw.

20

u/dacian88 Feb 18 '20

concepts, coroutines, modules

5

u/ar243 Feb 19 '20

What are modules

15

u/maxhaton Feb 19 '20

Something that C++ should've had 20 years ago

3

u/jiffier Feb 19 '20 edited Mar 06 '24

OMG OMG

2

u/MonokelPinguin Feb 19 '20

Yes, they will probably transition gradually, but since great care was taken to make them mix well, the transition should be smooth enough.

11

u/dacian88 Feb 19 '20

It's a different way to structure code in c++. Instead of using header files to connect code in different translation units or libraries you use what is deemed a module. Modules are theoretically only processed once per build invocation instead of vs headers where they are processed for every single translation unit that #include it.

2

u/kuikuilla Feb 19 '20

Basically instead of you doing the work of compiler by writing header files, the compiler works for you!

4

u/[deleted] Feb 19 '20

I gave up on this language. Life is already complicated enough, why do I need C++ to make it worse? Sorry, Bjarne, it's just not a good language anymore. C? Sure. C++? Not so much.

15

u/loamfarer Feb 19 '20

Essentially every ++20 feature is there to make life less complicated, and C++ more worth while. If C++ is worse it's only for other languages that raise the bar, but C++ in fact has never been better. The features fundamentally simplify the language.

If you learn any other modern language you'll immediately see the equivalent features in wide use, so it's not like you win by writing these features off. In fact many of these features have been around for ages already, and were worth learning years ago had you been in another language.

The languages I consider "better" than C++ are honestly just as complicated if not more.

4

u/HoratioMG Feb 19 '20

Every time I try to learn the ins and outs of it I just give up. There are so many ways to do anything that every tutorial looks like it's using a completely different language to the next.

To be a newbie to the language in 2020 is unforgiving, and from my perspective it's a complete mess.

3

u/TheDevilsAdvokaat Feb 19 '20

Seconding. I went from c to c++ to Delphi to visual basic to c#...

I have no desire to go back to c++. c I'd be willing to try again.

0

u/[deleted] Feb 19 '20

[deleted]

16

u/Jump-Zero Feb 19 '20

“When you have a lawnmower, every problem looks like an overgrown lawn”

2

u/BeniBela Feb 19 '20

Delphi was the right language for everything

2

u/VeryNiceTempAccount Feb 19 '20

Agreed. I feel like these new features are digging it a bigger grave.

1

u/ea_ea Feb 19 '20

Ok, this is video for fun. And where is the video with real introduction of core features?

1

u/Wastedmind123 Feb 20 '20

These adoption numbers are from 2019 -> https://www.jetbrains.com/lp/devecosystem-2019/cpp/

With 28% adoption of C++ 17, it will take roughly 5 years before half the developers adopt C++ 20. These numbers are probably only new projects, how many projects with continued maintenance will be left behind..

-34

u/_prototype_ Feb 18 '20

just give up on this insanely complex C++ nonsense and move on to next generation Rust please

11

u/[deleted] Feb 18 '20

Another rust evangelist :/

25

u/PewPewLazors Feb 18 '20

Nah it's more likely one of those trolls posing as obnoxious Rust fan boys because they hate Mozilla for some reason (something about codes of conduct and liberals, I don't quite get it). You can find these guys at the bottom of a lot of Rust related posts on this sub.

3

u/KinterVonHurin Feb 19 '20

and posts that aren't rust related

2

u/bumblebritches57 Feb 19 '20

You know, C++ is a giant mess and that's why I'm proud to be a regular C programmer.

But rust is somehow even worse than C++.

0

u/[deleted] Feb 18 '20

[deleted]

4

u/epicwisdom Feb 19 '20 edited Feb 19 '20

Yes unlike C++ where there's C++11, C++14, C++17, and now C++20, plus even older revisions of the standard which are still in common use. Not to mention GCC, MSVC, and Clang all having various incompatibilities and 20 different versions.

0

u/[deleted] Feb 19 '20

[deleted]

-3

u/epicwisdom Feb 19 '20 edited Feb 19 '20

How is Rust having one compiler that comes bundled with an automatic updater in any way comparable to C++'s ecosystem?

0

u/[deleted] Feb 19 '20

[deleted]

0

u/epicwisdom Feb 19 '20

Maybe because comparing C++'s ecosystem to rust's is like comparing a factory to a 3D printer?

Then maybe you shouldn't be pretending to make reasonable criticisms and turning around and crying foul when somebody points out your trite remarks are ridiculous.

or maybe because that crazy incredible feat of engineering can be replicated by just sticking to one toolchain in C++ for your project

Until you have to compile for a different platform or use a library written using some ridiculous, obscure feature.

0

u/[deleted] Feb 19 '20

[deleted]

2

u/epicwisdom Feb 19 '20 edited Feb 19 '20

I was comparing C++ to Rust as language.

No, you weren't. You were making a snarky remark.

Give someone clang and rustc and see which one is more complex for them to start being productive.

Most people use cargo, not rustc by itself. Using clang + another build tool + OS package management is a headache compared to using cargo. There are downsides to the approach, but in terms of basic usage cargo is much better IMO.

Rust already exceeds that complexity by a mile while being less productive

I completely disagree. C++ is insanely more complex. The C++17 standard is 1605 pages long. It's completely founded upon arcane abstractions like lvalues and rvalues which require you to think about what the compiler is doing rather than the code you want to write, and are riddled with exceptions and legacy quirks. Even reading and writing types is quite complex.

Rust avoids raw pointers, it was designed with reference semantics in mind. It has proper ADTs, generics, typeclasses (traits), modules, and macros. In my experience these basic modern features make for much higher productivity with much lower complexity.

with a 1000 times smaller ecosystem and without any level of maturity for anything that has to do with real world scenarios in networking, async, or other server scenarios. Maybe everyone should just write non-IO stuff until rust is ready for that.

If you have a need that can't be met using Rust right now, there's no problem with choosing not to use Rust because of that. I would never say that everybody should switch to Rust immediately. However, a young language is not the same as a bad language.

With a huge list of extremely well maintained and widely used set of tools and modern libraries, that isn't a factor for new projects. I'm not trying to integrate and maintain vim for 50 platforms that don't exist anymore.

Compared to Java, Python, or JS, C++'s cross-platform story is laughable. Simply having to use a GUI or graphics library immediately makes it very clear how difficult it is to use C++ for cross-platform applications. There's a reason that Electron, which pretty much literally bundles an entire browser engine with your application, is popular, and it's not because cross-platform development on C++ is easy.

0

u/[deleted] Feb 19 '20

[deleted]

→ More replies (0)

-10

u/[deleted] Feb 18 '20

He writes only insert user name here

Rust is way more complex than C++

15

u/Full-Spectral Feb 18 '20 edited Feb 19 '20

I don't think that's true. But, I'll be generous and agree maybe they are equally complex. But a lot of C++'s complexity comes from trying to fight the tools to manually ensure that things are going to happen correctly (and still having no certainty that they are.) A lot of Rust's complexity comes from working with the tool to ensure that things are going happen correctly, with a very high certainty that they are (at least within the constraints of what compilers are responsible for, it's not going to prevent you from making logical errors.)

-6

u/[deleted] Feb 18 '20

I meant complexity in terms of compilers actually. Sure it's still hard to make a C++ compiler but the ownership system in rust still seems like magic to me.

But for beginners, C++ is more complex than rust for sure.

9

u/Full-Spectral Feb 18 '20

I'm not sure what compiler writers would say, but I'd sort of bet that a C++ compiler is vastly more difficult, due to all of the backwards compatibility and evolutionary baggage and corner cases from all of layers of compromise over the decades.

2

u/flatfinger Feb 18 '20

What's ironic is that a lot of the "compromises" would never have been necessary in the first place if the Standard had either made clearer that the ability to meaningfully process certain constructs is a Quality of Implementation issue; implementations intended for purposes where the constructs would be useful should support them, but the Standard shouldn't force implementations to support constructs their customers won't need.

1

u/Y_Less Feb 19 '20

That sounds like you are saying that it would have been less complex of different compilers had done things in different ways, and you pick the one that matches your subset of requirements.

2

u/flatfinger Feb 19 '20

That sounds like you are saying that it would have been less complex of different compilers had done things in different ways, and you pick the one that matches your subset of requirements.

That's always been the actual state of affairs. The reason that a lot of low-level code won't work reliably on clang and gcc with full optimizations enabled isn't that the programs are defective, nor that the clang and gcc wouldn't be good for other purposes, but rather that while the authors of the C Standard explicitly stated that they did not wish to preclude the use of C as a "high-level assembler", they recognized that requiring that all implementations behave that way would make the language less useful for many other purposes.

The only problem with the state of affairs (but it's a big one) is that there is no standard means of specifying what particular features and guarantees are needed by particular pieces of code. If there were a means by which a program could say, e.g. "It would be acceptable for integer overflow to cause possibly-asynchronous abnormal program termination, set an implementation-defined overflow flag, or for it to behave as though it yields a result outside the range of the result type with non-deterministic upper bits, but it must have no other side-effects other than those above", then a lot of code could be written much more easily and safely than is possible in a language where people writing implementations for commonplace hardware think it reasonable to behave in ways contrary to the explicit documented intentions of the C Standard's authors (e.g. the way gcc processes

unsigned mul(unsigned short x, unsigned short y) { return x*y;}

which sometimes jumps the rails for values between INT_MAX+1u and UINT_MAX).

2

u/CoffeeTableEspresso Feb 19 '20

Sure but wait 20 years and Rust will be in a similar place as C++ is today...

2

u/Full-Spectral Feb 19 '20

Quite possible. But, hey, at least we have 20 years until then :-) I'll likely have to have someone cutting my food for me by then, at best.

-3

u/[deleted] Feb 19 '20

Loads of features robbed from D. sigh

4

u/bumblebritches57 Feb 19 '20

If you pay close attention, you'll notice one feature that is never stolen and the reason D hasn't and won't catch on.

Garbage Collection.

2

u/[deleted] Feb 19 '20

...which is entirely optional 🙄

6

u/MonokelPinguin Feb 19 '20

*if you don't use the standard library or other libraries, that depend on it. (At least that is my experience).

1

u/kprotty Feb 20 '20

This is a similar story to most language features: Rust stdlib, malloc book-keeping in C/C++, etc. You pay for what you use and if you rely on people which use something you dont want out of, say, convenience - then thats a dependency problem rather than a language problem.

-2

u/WhyWouldYou1111111 Feb 19 '20

list comprehensions or idc

0

u/[deleted] Feb 18 '20

[deleted]

12

u/bstamour Feb 18 '20

Yes.

3

u/FatalElectron Feb 19 '20

At least, once everyone starts rewriting into or providing module definitions

0

u/[deleted] Feb 19 '20

[deleted]

3

u/MonokelPinguin Feb 19 '20

Well, the standard is ready to be published, but since this is quite a major release, I expect compiler to still need about a year to catch up. GCC for example still hasn't merged the coroutine and module branches, iirc, but they are almost ready, just need some fixup for the latest spec changes and some bug fixing.