Live data from Hacker News

C++20, How Hard Could It Be

docs.google.com

151–160 of 444 posts

Re: C++20, How Hard Could It Be

#151

Is there a case for or against incrementally adopting Rust ?

Rust is too hard to learn.

I like it, but it only aims at replacing ada, not c++.

I asked around and there is currently no good way to make modern native ui apps with rust.

It would be okay if the syntax of rust looked a bit more like C, but it doesn't, it can be a bit difficult to read.

Re: C++20, How Hard Could It Be

#152
post #53

Many are of the listed items are merely being deprecated. These shouldn’t really qualify as breaking changes. In fact, the ability to migrate away incrementally is precisely the point of deprecating instead of removing a feature. What surprises me is that a lot of the deprecated functionality seems really recent — C++14 or newer. Compatibility is C++’s big thing, that’s historically why it kept almost all of C as a s…

Mostly deprecations mean something was deemed to be a bad idea, which means it's at the very least worth taking a moment to evaluate whether somehow they were a good idea when you did them.

For example should I have a method whose parameters are volatile? Well, why did I do that? It didn't do anything in C++ 17 and it still doesn't do anything in C++ 20 but now it's deprecated. Programs are written first and foremost to be read by other humans, but what was I trying to communicate by writing "volatile" on a parameter ?

The deprecation of composite operators on volatiles is an even better example. Those do something, but what they do might surprise programmers. Rewriting and then reading the rewritten example is an opportunity to discover that your code was broken anyway because now it's obvious. This obviousness is why deprecating the composites happened (and why it's sad that C++ 23 un-deprecates some of them).

Re: C++20, How Hard Could It Be

#153
post #49

Earlier quoted context omitted.

I think the main differentiators for clang were more readable error messages than the mess GCC had (and still has), and faster compilation (here it lost a bit of its advantage over time). I haven't heard of anyone praising it over GCC based on standard compliance. That said, when I explore weird edge cases in how differently Clang and GCC parse source code, and how differently they optimise it, in my experience Clang…

You don’t have to rewrite anything. C++ keeps backward compatibility. You don’t have to make it sound like it’s the case, and you don’t have to shame the "modern c++ crowd" over that false claim. That’s just uncalled for, unconstructive and partisan discourse. I expect better from HN.

Did you see the original post? Lots of code changes were required for Chrome. That’s not backwards compatible.

Re: C++20, How Hard Could It Be

#154

Earlier quoted context omitted.

When I was going to university the computer science department's primary system had two compilers available, GCC 2.96[0] and TenDRA. GCC was generally more popular but it didn't have std::string and any code that threw an exception would crash, so adventurous students would use TenDRA for development. One of the stranger behaviors of TenDRA was that it put all standard library symbols, including the C headers , into…

2.96 exists, at least in the RedHat world. $ rpm -qi gcc Name : gcc Relocations: (not relocateable) Version : 2.96 Vendor: Red Hat, Inc. Release : 110 Build Date: Fri 12 Apr 2002 10:30:47 PM UTC Install date: Thu 20 Jan 2011 03:34:36 AM UTC Build Host: daffy.perf.redhat.com Group : Development/Languages Source RPM: gcc-2.96-110.src.rpm Size : 8389509 License: GPL Packager : Red Hat, Inc. URL : http://gcc.gnu.org Summ…

[deleted]

Re: C++20, How Hard Could It Be

#155
post #43

Earlier quoted context omitted.

gcc is better than clang on every metric. Sorry, it's the facts. ¯\_(ツ)_/¯

I've always preferred clang for its better lints, and friendlier error messages (sans some decrepit parts around templates that are equally horrendous everywhere)... And theoretically clang has better ASM output in some cases I say theoretically, because it's been shown that GCC's "worse" ASM performs better; I'm not really an architecture aficionad, so I can't comment as to why that is. Also, it's been a few years n…

clang doesn't output asm

Re: C++20, How Hard Could It Be

#157

Earlier quoted context omitted.

LLVM always delivers the cooler stuff I'll admit but GCC is ahead as an optimizing compiler, general lang support and generating cryptic messages.

Interesting, I've generally found that clang is better at optimising, especially when it comes to auto-vectorisation.

Agreed, autovec is in my experience where clang really shines.

Re: C++20, How Hard Could It Be

#158
post #135

Earlier quoted context omitted.

> The C++ standard currently sits at >1800 pages. Looking through these examples, I'm honestly horrified. I feel you're embelishing too much your personal feeling of horror. The C++20 standard doc is a hair smaller than 1900 pages, but the complete core language is specified in the first 460 pages, of which around 100 are dedicated to templates. Thus around 1400 pages of a 1900page doc are dedicated to specify librar…

You could focus on those 460 pages but I'll raise 2 points: 1. There's still a lot of complexity and ambiguity you can fit in 460 pages. This presentation notes one example of decrement operators on volatile variables being deprecated because the behaviour was undefined; and 2. Can you really separate the standard library from the language at this point? Things like move semantics depend on std. Does anyone actually…

1. No, that's wrong. Incrementing a volatile isn't undefined. The problem is that some people are using volatile when they actually want atomic variables, so the behavior of the program becomes undefined when you have two threads incrementing the same volatile variable at the same time. The compiler might or might not compile volatile_variable++ into an atomic operation, but some people wrote code under the misunderstanding of the language that it always would.

2. Sure. While it's true that using certain features of the language technically requires parts of the standard library, those parts are very few and very simple. What is there? std::move(), std::pair and std::tuple, , and perhaps a couple other things?

Re: C++20, How Hard Could It Be

#160

Earlier quoted context omitted.

One day in the far away future the standard C++ hello world will use 'import std;' and 'std::print' and it will be glorious.

When I was going to university the computer science department's primary system had two compilers available, GCC 2.96[0] and TenDRA. GCC was generally more popular but it didn't have std::string and any code that threw an exception would crash, so adventurous students would use TenDRA for development. One of the stranger behaviors of TenDRA was that it put all standard library symbols, including the C headers , into…

https://en.cppreference.com/w/cpp/header/cstdio#Synopsis.
Post reply on HN