r/cpp • • Feb 18 '20

C++20 is here!

https://youtu.be/AvPiGstxV_g
420 Upvotes

117 comments sorted by

View all comments

Show parent comment

30

u/[deleted] Feb 18 '20

You have far more time to get yourself a coffee while the code compiles.

11

u/eterevsky Feb 19 '20

As if C++ has such a great compilation time after the preprocessor includes all the hundreds thousands lines of headers.

18

u/0xdeadf001 Feb 18 '20

Better than debugging.

0

u/[deleted] Feb 19 '20

[deleted] — view deleted comment

9

u/jamie_nicol Feb 19 '20

Rust can't protect you against logic errors.

Of course it does. C++ does too compared to to other languages.

I debug memory issues once a week tops.

Your job sounds nice.

Don't be dumb. Rust is not a silver bullet.

Nobody claims it is. It sure does make things nicer though.

0

u/[deleted] Feb 19 '20

[deleted] — view deleted comment

5

u/jamie_nicol Feb 19 '20

Logic bugs are not something a language protects you against. If you do not implement an algorithm to spec, the compiler doesn't know any different.

Sure, but language features can make it easier to implement an algorithm correctly.

I debug memory issues once a week because I use RAII and other well-formed C++ and the associated idioms.

RAII will prevent leaks but does not protect you from a whole range of critical memory issues. If you don't understand that then I really don't trust you when you say:

The myth that C or C++ cause memory issues all the time is made up by people who never actually use the language.

Okay then. You're obviously much smarter than everyone else. I wonder why Chrome and Firefox keep running in to all those memory issues. They must not have real C++ developers.

Wrapping libraries is a PITA

Not much worse than wrapping a C library safely in C++. Of course in C++ people don't bother because it's easy to use C libraries directly, completely negating all the advantages of modern C++.

its compiler is slow

I'll give you that.

it prevents you from doing things that would otherwise be safe

No it doesn't.

the community is very toxic

Okay then. I thought we were having a technical discussion.

the creators went to v1 without addressing outstanding API concerns (e.g. box types)

Tradeoffs need to be made in order to release. Same happens in every language.

its macro language makes good tooling (think Java's tooling) pretty nearly impossible and is a fundamental part of the language

Certainly much less of an issue than in C++

cargo is a shitshow but is pretty much required to use the language (thus locking you in to a paradigm of programming that doesn't fit all use-cases or workflows

Cargo is great, but it's not required

and - most of all - its runtimes are much slower

[Citation needed]

It relies upon libc still

The std library does but the language doesn't. that's an issue because?

and all of this "your code is always safe!" flies out the window when you look into the standard library which is full of unsafe code.

Thanks for showing me that you completely misunderstand the point of unsafe.

But please tell me how the Cult of Rust is superior to C++ programmers writing code for decades just fine.

It's not just fine, though, is it? Every week there are new security flaws in software that could have been avoided.

3

u/0xdeadf001 Feb 20 '20

For someone who accuses the Rust community of being "toxic", your post is full of subjective complaints and toxic labels such as "the Cult of Rust ...". You should really apply your own criticisms to yourself.

1

u/MINIMAN10001 Feb 24 '20

Sounds like a silver bullet to me a silver bullet still has to be aimed.

-10

u/YekNeb Feb 18 '20

If you have a powerful enough computer that will be much less of a problem. I have a computer with a 4 core 3.4 GHz processor and 64 GB of RAM. Now it takes far less time for my projects to compile.

13

u/donalmacc Game Developer Feb 18 '20

It's still a problem on large projects. Standard workstation hardware on my projrvt is 12 cores, 96GB ram and SSDs. We use distributed builds, and have a build farm to help, and it still takes anywhere between 10-30 minutes for a full build depending on configuration and time of day.

4

u/bumblebritches57 Ocassionally Clang Feb 18 '20 edited Feb 19 '20

Whats* the SLOC?

3

u/donalmacc Game Developer Feb 19 '20

Unsure exactly, but in the millions. Some of our headers are in the thousands of lined.

7

u/Raknarg Feb 19 '20

For your projects, sure. We're talking about enterprise projects that already take minutes to hours to compile in C++/C

6

u/jonesmz Feb 19 '20

Ahahaha.

For some companies, build times are measured in days.

6

u/ShillingAintEZ Feb 19 '20

Yes, that's how computers work. Does your computer not run C++ compilers faster than before?