3 ms·
In her first sentence, the phrase “the C / C++ programming language” is no longer correct: C++20 requires two’s complement signed integers. C++ 20 is quite new
by gumby 6y ago
In her first sentence, the phrase “the C / C++ programming language” is no longer correct: C++20 requires two’s complement signed integers.
C++ 20 is quite new so I would assume that very few people know this yet.
C and C++ obviously differ a lot, but by that phrase she clearly means “the part where then two languages overlap”. The C++ committee has been willing to break C compatibility in a few ways (not every valid C program is a valid C++ program), and this has been true for a while.
- loeg 6y agoIt hasn't been true since C99, at least -- C++ didn't adopt C99 designated initializers.
- hctaw 6y agoWhat chips can be targeted by C compilers today that don't use 2's complement?
- gumby 6y agoI haven’t seen a one’s complement machine in decades but at the time C was standardized here were still quite a few (afaik none had a single-chip CPU, to get to your question). But since they existed, the language definition didn’t require it and some optimizations were technically UB. The C++ committee decided that everyone had figured this out by now and so made this breaking change.
- klyrs 6y ago"the c/c++ language" exists insofar as you can import this c code into your c++, and this is something that c++ programmers need to know how to do, so they'd better learn enough of the differences between c and c++ or they'll be stumped when they crack open somebody else's old code.