News for hackers. Stuff that matters.
Re:Does C++ still deserve a bad rap? by formerly_proven on Saturday October 17, 2020 @06:20AM (#24808965)
To be fair, C++'s standard I/O library is really bad. There is probably an almost universal consensus in the C++ world that the locale library is the worst standard library, immediately followed by iostreams. For small programs that's annoying, although using libc IO is usually fine for them. However, C++ is probably one of the top 3 languages for developing large applications (Java would also be there, not sure which one is the third in that pack) and for these having to roll your own IO is usually no biggie, because it probably would have been done anyway (e.g. even if iostreams wouldn't be so bad, it would likely have no place in the IO system of a content creation app or being used in HDF5).

In that sense, C++ is not batteries included, which can be annoying for small and medium projects.

Re:Does C++ still deserve a bad rap? by Retric on Saturday October 17, 2020 @09:05AM (#24809666)
In terms of large projects C++’s role is very much shrinking. C++’s last major strength is being cross platform, but new platforms keep excluding it. You can’t program on iOS or client side websites with it. Microsoft actively discourages using C++ on Windows, and C# took over for large projects.

Essentially C++ and the modern ideas about computer security are at war.

Re:Does C++ still deserve a bad rap? by jandrewrogers on Saturday October 17, 2020 @12:21PM (#24811075)
For data-intensive applications, which are only increasing, C++ is the only game in town. State-of-the-art architectures typically rely on schedule-based safety models that are not productively expressible within Rust's ownership-based safety model, and the performance characteristics of working within these respective safety models is not comparable. There aren't many alternatives when a GC language is a non-starter due to the adverse impact of a GC on throughput. C++ is winning for data-intensive apps not because it is great (it isn't) but because there isn't a practical alternative.

I've seen Rust being used for the layer above C++, where it doesn't have to deal with I/O, scheduling, etc that don't play well with Rust but you still want the throughput/latency and memory safety.

Re:Does C++ still deserve a bad rap? by Retric on Saturday October 17, 2020 @01:22PM (#24811521)
Twitter which is at the outer edge of throughput uses Scala and Java. Language choice of just about anything being viable for what most companies consider high throughput computing. For companies spending 8 figures on hardware it’s something to consider, otherwise it’s basically irrelevant IMO.

Hell, highly optimized numerical simulations are still being written in freaking Fortran.

Re:Does C++ still deserve a bad rap? by roca on Sunday October 18, 2020 @06:16AM (#24816744)
What exactly do you mean by "schedule-based safety model"?
Re:Does C++ still deserve a bad rap? by jandrewrogers on Tuesday October 20, 2020 @01:35AM (#24834206)
Many safety issues in complex compute environments are predicated on the notion that many different threads/contexts can manipulate the data structures in somewhat arbitrary and unpredictable orders. This is approximately correct for classic multithreaded software.

In some software architectures, there are schedulers with a global view of the entire (potential) conflict graph and they have complete control of what gets executed when. These architectures don’t even require locks because the scheduler has enough visibility and control to guarantee that execution won’t be scheduled such that there would ever be a contended lock or some other concurrency conflict. No amount of mutable references to the same memory will break these models, and the correctness of some implementations have been formally verified. The scheduler can always dynamically reorder execution to guarantee the invariants of the system. These models have the added benefit of having insanely good locality properties such that throughput is excellent.

These software architectures originated in HPC over a decade ago and eventually bled over into high-end database kernels. I learned it from when I worked in HPC many years ago and have used it every since, due to its unambiguous advantages.

Re:Does C++ still deserve a bad rap? by roca on Tuesday October 20, 2020 @06:57PM (#24843145)
Thanks! Sounds interesting, but it's not obvious to me that such a framework can't be captured in the Rust type/ownership system in a reasonably ergonomic way. Has anyone even tried doing that?

For example you might be able to wrap shared-mutable state in a kind of degenerate mutex and pass a "scheduler guarantee" token around that unlocks those "mutexes" without doing any runtime work.

Re:Does C++ still deserve a bad rap? by infinite8s on Tuesday October 20, 2020 @02:19PM (#24840661)
Do you have any references to HPC systems that exemplify this approach?
Re:Does C++ still deserve a bad rap? by blub on Saturday October 17, 2020 @05:45PM (#24813654)
What a load of nonsense...

1) Neither iOS, nor "the web" are new platforms.

2) Not only you can program with C++ on iOS, it's heavily used in certain kinds of applications.

3) Why would anyone single out a specific language and claim that it's a problem that you can't use it to build websites with it? This applies to all languages with one exception. Or it did, because now there's WebASM, which makes this argument even more bizarre.

4) C++ had and has first-class support on Windows.

Re:Does C++ still deserve a bad rap? by Retric on Saturday October 17, 2020 @09:54PM (#24814987)
C++ is 35 years old significantly older than client side web programming. iOS apps are only 12 years old. So, they both showed up well after C++ was a mainstream language.

2) Objective-C++ may look like C++ but their different languages. As always beware of edge cases.

3) WebAsm is somewhat “supported“ by 92% of web browsers which sounds great but isn’t enough to be viable for companies like Amazon. But hey it’s a cool toy if you don’t have real work to do.

4) I have run into plenty of missing C++ documentation when C# documentation was available on Windows. It’s supported sure, but very much a second class citizen.

Re:Does C++ still deserve a bad rap? by lenkite on Saturday October 17, 2020 @12:08PM (#24810982)
Modern C++ is actually encouraged on Windows with Microsoft making standards compliant and supported frameworks like C++/WinRT for WinUI3.

https://docs.microsoft.com/en-us/windows/apps/winui/winui3/x...

Re:Does C++ still deserve a bad rap? by Sindisil on Saturday October 17, 2020 @11:42AM (#24810786)
> Microsoft actively discourages using C++ on Windows,

Really? That's the opposite of my impression. It seems to me that they promote it as co-equal to C# as primary focus in their constellation of supported and encouraged application programming languages.

Re:Does C++ still deserve a bad rap? by CodeGlitch on Saturday October 17, 2020 @10:45AM (#24810315)
Just thought I'd post to say I think you are spot on with this comment.