News for hackers. Stuff that matters.
Re:Modern C for C++ Peeps by tejohnso on Saturday January 07, 2023 @12:08PM (#34290078)
> There is really no legitimate reason to code C anymore

That's an interesting statement. Reminds me of statements indicating any new code base should be started in rust over c++.

Re:Modern C for C++ Peeps by pjmlp on Saturday January 07, 2023 @12:27PM (#34290309)
The rewrite in C++ movement was lived in Usenet flamewars, and we were in good path with all the userspace C++ frameworks in OS/2, MS-DOS, Windows, Apple and BeOS until the GNU Manifesto came around and urged everyone to write FOSS code in C.

"Using a language other than C is like using a non-standard feature: it will cause trouble for users. Even if GCC supports the other language, users may find it inconvenient to have to install the compiler for that other language in order to build your program. So please write in C."

GNU Coding Standard in 1994, http://web.mit.edu/gnu/doc/html/standards_7.html#SEC12

Re:Modern C for C++ Peeps by moloch-hai on Saturday January 07, 2023 @01:21PM (#34290892)
Stuff written about C++ before there was an ISO Standard obviously does not apply after. And, we should know by now how much Richard Stallman's prejudices are worth.
Re:Modern C for C++ Peeps by pjmlp on Saturday January 07, 2023 @02:01PM (#34291366)
By all means, GNU Coding standards from 2006, 8 years after C++98.

"When you want to use a language that gets compiled and runs at high speed, the best language to use is C. Using another language is like using a non-standard feature: it will cause trouble for users. Even if GCC supports the other language, users may find it inconvenient to have to install the compiler for that other language in order to build your program. For example, if you write your program in C++, people will have to install the GNU C++ compiler in order to compile your program.

C has one other advantage over C++ and other compiled languages: more people know C, so more people will find it easy to read and modify the program if it is written in C.

So in general it is much better to use C, rather than the comparable alternatives."

http://gnu.ist.utl.pt/prep/standards/html_node/Source-Langua...

As project lead, his opinions always mattered for what goes into GNU.

What the rustaceans are doing nowadays I lived as C++ fanboy, so I am pretty aware how things went.

Remember that besides the license issue, another big reason why GNOME came to be was because KDE uses C++, hence the whole GObject stuff in C.

Re:Modern C for C++ Peeps by moloch-hai on Saturday January 07, 2023 @02:13PM (#34291516)
You emphasize my point so clearly, I need add nothing.
Re:Modern C for C++ Peeps by pjmlp on Saturday January 07, 2023 @03:31PM (#34292412)
That is now, we were talking about when GNU/Linux started to be relevant and what triggered language choice, versus what was happening in the desktop PC world.

The latest version of the GNU coding standard is much more permissive.

Re:Modern C for C++ Peeps by zozbot234 on Saturday January 07, 2023 @07:17PM (#34294584)
Yes but back then you could compile C with a C++ compiler and get the same type checking as in actual C++. There were a few pitfalls but a shared "Clean C" coding style was viable and that's what most of the rewriting effort was focused on.

C++ did add stronger modularity with its public and private member specifiers, namespacing etc. but that was mostly useful on larger projects.

Re:Modern C for C++ Peeps by moloch-hai on Saturday January 07, 2023 @01:19PM (#34290869)
Rust can still fizzle, like Ruby has.

It is still far from clear whether anybody will be learning Rust, in ten years, instead of whatever is the new hotness then. Hiring a domain expert who also knows Rust is generally impossible today, and will be for, at least, a long time. So, starting a new project in Rust is OK for a project you know won't matter, but absurdly risky for one that will.

C++ is mature. None of the above is a concern, for C++.

Re:Modern C for C++ Peeps by AgentOrange1234 on Saturday January 07, 2023 @02:48PM (#34291890)
Hrmn. Hiring rust experts may be hard, but the opportunity to learn rust on the job could be appealing to a lot of devs who want to grow?
Re:Modern C for C++ Peeps by moloch-hai on Sunday January 08, 2023 @12:45AM (#34296436)
Domain experts are focused on their domain. Becoming a beginner again is a recipe for radically reduced productivity. The people eager to learn a new language on the job are generally those who have not invested much in anything.
Re:Modern C for C++ Peeps by AgentOrange1234 on Sunday January 08, 2023 @09:13AM (#34299235)
It’s not like rust is some radically different thing. Getting productive with it should take a good developer what, a couple of months?
Re:Modern C for C++ Peeps by int_19h on Saturday January 07, 2023 @05:04PM (#34293403)
In terms of adoption by pre-existing large players in the industry, Rust is already ahead of where Ruby was at its hype peak. It's just not quite as shiny because that code is not running some web app that is immediately demo-able, but some boring OS infrastructure stuff.

Given the money already invested into internal tooling and infrastructure specifically for Rust, I just don't see those large companies suddenly dropping it. Regardless of how good the language itself is, the sunk cost alone makes it hard to turn ship. And the language is good, so it'll use that time to entrench itself further.

Re:Modern C for C++ Peeps by moloch-hai on Sunday January 08, 2023 @12:54AM (#34296474)
They won't drop the language: whatever products depend on it will continue to depend on it. Unless hiring gets difficult; then they will transcribe it to a more mainstream language. In the meantime, language choice for new projects will be driven by experience hiring into these and other projects.

Other, newer languages will come up continually, siphoning off the most mobile who have begun to find Rust familiar and pedestrian.