Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
ISO/IEC 14882:2020 C++ Standard Published (iso.org)
26 points by apaprocki on Dec 15, 2020 | hide | past | favorite | 16 comments


Impressive how C++ always attracts a naive and uninformed toxicity on HN. C++20 is amazing, there has been so much incredible work put in my some many amazing engineers.

Yes there are competitors to C++, and we all love an underdog story, but I personally find it to be the only language with this level of expressiveness, without sacrificing complete control. You can write JS-style, with auto and other zero-runtime-cost abstractions, or you can write plain C with function overloading and templates.

C++20 is an incredibly exciting milestone, and I congratulate the standards commitee on every little milestone. Great work, guys!


I just pray that modules will one day let developers speed up compile times.

Toolchain complexity, size and slowness are the only things that make me use python.


> I just pray that modules will one day let developers speed up compile times.

Compiles times are not a problem if you use adequate tools. I have a codebase that heavily uses some large libs such as boost and Qt, here's a video of the edit-compile-run cycle:

https://streamable.com/o2g765

compilation when editing a file takes one-two seconds (measured it at 101 frames in the video in this case, so a bit less than 2 seconds).

If anyone's wondering how it's done:

- Clang & lld instead of GCC & bfd/gold

- Ninja instead of Make (or anything else really)

- CMake target_precompile_headers

- Code split in dynamic libraries for dev builds

There aren't even advanced tricks such as incremental linking mentioned by other comments.


My C++ coding on Windows with VC++ is usually faster than Rust coding, because of incremental compiler, incremental linking and using binary libraries for 3rd party dependencies (DLL/COM).

I think when modules mature, it can eventually reach Delphi/.NET like compile speeds.


clang and MSVC both already (partially) support modules! other than that, gcc is the most c++20-feature-complete compiler


1853 pages. Oof.


It includes the standard library, still way smaller than Java, C#/VB/F#/.NET or Python standards.

For a language like C, add the POSIX standards, which is like C's extended library.


C# standard has 550ish pages https://www.ecma-international.org/publications/standards/Ec...

Are you making the numbers up?


No, I explicitly mentioned "standard library", you are missing these ones as well.

https://www.ecma-international.org/publications/standards/Ec...


C# standard doesn't define the standard library, it only gives you the class prototypes (from pages 463-473 from what I can see) while the C++ standard does give you preconditions and postconditions for every function, complexity bounds for algorithms, etc. (from pages 458 to 1609, so by far the majority of the thing). C# also does not define threads, linq, etc... which if it was C++ would all have to be defined in the standard.

If you compare only the language definition itself, C++ is actually shorter by a couple pages than C#: it ends at page 457 on the pdf:

https://isocpp.org/files/papers/N4860.pdf


And somehow still insufficient. They can't find words in all that to define some undefined behavior?


Undefined behavior isn't undefined because somebody didn't have enough words to nail down a definition. It's undefined by definition.


And some of them does a "sane" defined thing on some of the platforms, but enforcing them for all of the platforms would mean a lot of burden to the implementors working on those.


some behaviors are defined to be undefined because there is no sane way to universally define them in a way that doesnt cripple the range of supported hardware & OSs.


They found them, because UB cases are documented actually.


It's a cultural problem. The standards committee cares about security than micro-benchmarks on legacy hardware.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: