Live data from Hacker News

C++20, How Hard Could It Be

docs.google.com

271–280 of 444 posts

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

#271

In a few months, I might be switching to a team with a C++ project. A lot of the team is new to C++, and there's nothing about the project that needs C++, Java would have been fine. This doesn't look very fun.

C++ has a lot of sharp edges. Skimming through the slides it seems as though Chromium hit upon a lot of the big problems because: 1. Google always seem to enjoy bucking the trend in terms of recommended ways to do things and end up using niche features that are likely to be deprecated 2. Chromium is a stupidly massive codebase so they have more things to fix just purely through scale If you stick to the sane subset o…

C++ was the right choice for broader organizational reasons, but the wrong choice for what the project needs.

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

#272
post #260

Say I have a new project to start today. I need pick a language to use: 1. a well-tested language 2. can not use garbage collector due to *performance* requirement 3. easy to hire if project expands. 4. ready to use tooling support 5. widely available tutorials and info on the web. 6. language is itself alive and updated 7. project can be scaled over time. what options do I have? I have to pick up c++ in this case. i…

I wonder how much of (2) is speculative and how much of it is a real need in actual projects.

In my experience 99% speculative and WRONG. Who said: "early optimization is the root of all evil"? :) Today more and more is possible to have a GC without terrible performance issues. Some weeks ago I read an article here in HN, about LISP used for safety critical systems. That bad fame of GC comes from the early versions of Java... but I've been using GC languages a LOT, and never had those "stop the world" moments.

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

#274
post #262

Earlier quoted context omitted.

The way I look at it is we're in a transitional period. A language like Go or Rust can replace some of the C++ lift, but we're not sure because they're not a large body of experience with those languages. I suspect, but can't say with any certainty, that we'll wind up in a world where the use case for C++ shrinks significantly. Rust and Go will eat into the share of new Greenfield systems that would have normally gon…

> Sixth, there's counter evidence to support a lack of adoption of new languages. Ada provides many of the same concurrency and memory safety guarantees as Rust, and has been available since 1983, but it is not widely adopted. It is harder to use and requires significant developer training. If Rust is significantly more challenging for developers, it may go the way of Ada. Rust is definitely difficult to learn, but I…

In the aeronautics and space industry Ada was and is popular. Ok, not the biggest industry, but still...

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

#275
post #267
post #212

Earlier quoted context omitted.

>Java for enterprise or Android >C# if you are windows developer Picking Java over kotlin for android, or lumping C# into "just for windows" bucket is exactly the ignorance that leads you to "we don't have choices" conclusion. If you always default to literally top1 language for given domain, then how can you expect to have multiple choices? I'm not talking about using some brand new gimmick that came out yesterday a…

TBH I was shocked by "Python for machine learning". I do not know where that comes from. Maybe because some important toolkits are available for Neural Networks? But machine learning is not neural networks... you can do it with NNs, but there are so many other algorithms... I'm really surprise of this kind of posts in hacker news. I thought the audience here has other experiences.

Python is the main language for PyTorch and TensorFlow, there are few ML frameworks more complete than Scikit-learn, I'm not aware of an equivalent to NumPy in other languages, and this list is probably missing other things I don't use.

What's the alternative for quick ML prototyping?

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

#276
post #241

Earlier quoted context omitted.

I don't know if you've read the benchmark code from The Benchmark Game, but anyone who has looked at the code takes those results with a grain of salt, or discards them entirely. For example, the C/C++ implementations use arena allocators, and they could do the same for the Go implementations, but they don't. The Benchmark Game is a joke. Here it is, for anyone who wants a good laugh: https://benchmarksgame-team.page…

Compare GC Java with GC Go. https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Thanks for the work separating out the solutions. It really helps compare the sort of code I'd actually write in those languages. Also, what is the reasoning behind no numpy? I'd never do something like nbody or Mandelbrot without numpy or torch in my actual job, so it isn't idiomatic in a way. Not a complaint, I could always fork it if I cared enough, just curious about the reasoning. I know pypy didn't really want to be involved. Thought it might be like that for numpy?

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

#277

So, it seems most problems are C++ making things extra bureaucratic and annoying. Cool The "pre/post increment of volatiles is deprecated" sounds like a huge pain. I can't imagine a worse waste of developer time than fixing such a minor thing (and to be fair C allowing both a++ / ++a should never have existed)

That's been undeprecated in C++23. It's mildly embarrassing, but it shows the process works.

Are all of C++20’s volatile deprecations un-deprecated in C++23? This doc from 2020 lists all:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p21...

But this proposal from 2021 suggests only undeprecating bitwise compound operations:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p23...

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

#278
post #267
post #212

Earlier quoted context omitted.

>Java for enterprise or Android >C# if you are windows developer Picking Java over kotlin for android, or lumping C# into "just for windows" bucket is exactly the ignorance that leads you to "we don't have choices" conclusion. If you always default to literally top1 language for given domain, then how can you expect to have multiple choices? I'm not talking about using some brand new gimmick that came out yesterday a…

TBH I was shocked by "Python for machine learning". I do not know where that comes from. Maybe because some important toolkits are available for Neural Networks? But machine learning is not neural networks... you can do it with NNs, but there are so many other algorithms... I'm really surprise of this kind of posts in hacker news. I thought the audience here has other experiences.

That's literally the only one that didn't shock me. What universe do you live in where machine learning algorithms aren't tied together with Python? And what industry where machine learning is not mainly neural networks?

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

#279

Earlier quoted context omitted.

it's not that you need it, it's that when destructuring, std::tuple_size / std::tuple_element are implicitly checked to see how destructuring can be made to work if you have a type with some custom destructuring. (example: https://gcc.godbolt.org/z/5jq61oox7 ) If they are not available or just not overloaded (e.g. when destructuring some basic struct) it just falls back to the destructuring one expects. So you need f…

This whole thread is why c++ is..bad. It just leaves me with a sense of hopelessness.

Which language do you use?

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

#280
post #34

Earlier quoted context omitted.

Yes to some extent, depends on how one wants to defend their paper at ISO, during the several voting sessions. Even when they do, it is in prototype done by the paper's author, not necessarily something that you can merge right away into upstream. Visual C++ is already there in C++20 and increasingly improving C++23 support as well.

I wonder if a feature has been accepted that turned out to not be tractably implementable! I work on Ruby compilers and people often suggest features that they don’t realise would be catastrophic for performance if implemented, or are sometimes literally impossible to implement.

Template export was implemented by a single compiler vendor, and that served as a cautionary tale for all other vendors against trying the same.
Post reply on HN