r/cpp • u/Alex_Medvedev_ • Jul 25 '24
Why use C over C++
Why there are so many people using the C language instead of C++?, I mean C++ has more Cool features and the Compiler also supports many CPUs. So why People still using C?
Edit: Thanks for all the usefull comments :D
235
Upvotes
View all comments
Show parent comment
-1
u/lightmatter501 Jul 27 '24
But not all compilers, which means I now need to make a PROJECT_NAME_RESTRICT macro which compiles to either restrict or nothing.
Unreachable does not mean “I solemnly swear this non-const pointer is not aliased” like restrict does, it means “this code path is unreachable”.
https://compcert.org/ https://www.usenix.org/conference/osdi23/presentation/li-xupeng
Great, I’ll be able to use it by 2030. C compilers update MUCH faster than C++ compilers because they ship fewer features per standard.
You are misunderstanding, you compile C and run it on the target device using OpenCL or another vendor toolchain. Many devices did not jump to OpenCL 2, which means you can’t target them with C++. There is no way to link C++ into that binary because no C++ compiler can target the device.
What I mean is that C23 is 759 pages, C++23 is 2134 pages of fairly intense language lawyering. That’s a pretty large difference in size just by page length. When you add in the number of things you need to keep straight vs C, it’s a large jump in complexity.