4 ms·
I think the undefined behavior in C and C++ are even less defensible today than when they started because of the convergence of architectures. Pretty much ever
by RcouF1uZ4gsC 5y ago
I think the undefined behavior in C and C++ are even less defensible today than when they started because of the convergence of architectures.
Pretty much every non-legacy architecture does IEEE floating point. Pretty much all of them do a flat address space. The word size is some power of 2(32 bit, 64 bit, maybe 128 bit in the future). They are almost always little endian. The memory models are converging towards the C++ memory model.
Given that, I think simplifying the language and getting rid of foot guns could be done without losing any significant performance or actual flexibility/portability.
- pjmorris 5y agoIt could be called 'C--' unless that's been taken.
- RcouF1uZ4gsC 5y agoThere is a language C-- created by Microsoft Research (Simon Peyton Jones of Haskel and GHC fame) https://www.microsoft.com/en-us/research/wp-content/uploads/1998/01/pal-manual.pdf https://www.microsoft.com/en-us/research/wp-content/uploads/...
- jandrese 5y agoYou could also add that they all do 2s complement math. This is what the OpenBSD team did to OpenSSL. If the code has some complexity that is only necessary because it might have been run on a VAX or AIX or early Cray architecture then it is time to excise that complexity. They deleted thousands and thousands of lines of support for architectures that are only seen in museums and landfills today.
- astrange 5y agoC does require 2's complement math. However architectures of the future aren't going to have flat pointers (PAC/CHERI etc), and even current architectures have some non-IEEE floats (https://en.wikipedia.org/wiki/Bfloat16_floating-point_format https://en.wikipedia.org/wiki/Bfloat16_floating-point_format / https://en.wikipedia.org/wiki/Unum_(number_format) https://en.wikipedia.org/wiki/Unum_(number_format)).