News for hackers. Stuff that matters.
Re:Confession Of A C/C++ Programmer (2017) by zabzonk on Monday January 25, 2021 @10:56AM (#25904633)
I agree that people that think there is a language called C/C++ probably don't have much of a clue, but it is certainly possible to program in both C and C++ and do a good job in both.
Re:Confession Of A C/C++ Programmer (2017) by jstimpfle on Monday January 25, 2021 @12:32PM (#25906037)
In my perception there is a group of considerable size who thinks that C++ is largely b*s*, but still uses C++ (technically) for one reason or another (availability of compilers, interfacing with existing ecosystems, availability of jobs) - in a way that is basically C with almost no C++ features.

This is a group of people that considers themselves systems programmers in the first place, and doesn't really care about the language very much, except that they don't want to have to deal with stuff like this: https://twitter.com/fabynou/status/784905829866614784

I don't see any reasons for the people in this group to not consider them "C/C++ programmers". Au contraire, I've found the people that like to point out that "C/C++ isn't a language" to be annoying nit-pickers that care too much about the language and too little about systems programming.

Re:Confession Of A C/C++ Programmer (2017) by flohofwoe on Monday January 25, 2021 @11:13AM (#25904850)
The common subset of C and C++ is different enough from "idiomatic" C and C++ that it almost can be called a separate "C/C++" language ;)
Re:Confession Of A C/C++ Programmer (2017) by zabzonk on Monday January 25, 2021 @11:49AM (#25905371)
The common subset should probably be called something like "better C" - it won't be able to use any major (or many minor) C++ features. Basically, it will be ANSI C (give or take). Noticeably, the code for the 2nd Ed of The C Programming Language was tested using a C++ compiler, not a C compiler
Re:Confession Of A C/C++ Programmer (2017) by flohofwoe on Monday January 25, 2021 @05:35PM (#25909898)
The common C/C++ subset is an outdated and non-standard C though. For instance standard-conforming C++ compilers cannot compile C99 code and onward, they're stuck at a non-standard C version that would roughly be C95, minus some things that are valid C but not valid C++.
Re:Confession Of A C/C++ Programmer (2017) by pjmlp on Tuesday January 26, 2021 @02:46AM (#25913489)
They can compile more C11 code than C99, thanks to the stuff dropped in C11.

They also support most of the C standard library additions.

As of C++20, the biggest difference is that designated initializers must follow field declaration order, restrict and _Generic aren't supported, and the type safety semantics are stronger.

Re:Confession Of A C/C++ Programmer (2017) by flohofwoe on Tuesday January 26, 2021 @04:30AM (#25913960)
There's also a handful of small differences like this, e.g. in C it's possible to construct a value and take the address for a pointer argument right in the function call:

    func(&(bla_t){ .x=1, .y=2 });
This is completely valid C, but invalid C++ (C++ has references as "workaround" for such adhoc-constructed parameters which shouldn't be passed by value).
Re:Confession Of A C/C++ Programmer (2017) by pjmlp on Tuesday January 26, 2021 @06:04AM (#25914478)
Yes, that falls under my "type safety semantics are stronger" part of the comment.