3 ms·
Unless you are talking about PIC and similar CPUs, there is hardly a modern 16 bit CPU that doesn't have a C++ compiler available as well, assuming that we stil
by pjmlp 1y ago
Unless you are talking about PIC and similar CPUs, there is hardly a modern 16 bit CPU that doesn't have a C++ compiler available as well, assuming that we still consider 16 bit modern for whatever reason.
Heck I learned to program in C++, back when DR-DOS 5 was the latest version, and all I had available was 640 KB to play around, leaving aside MEMMAX.
Nowadays the only reason many embedded developers keep using C is religous.
- uecker 1y agoReligion and the garbage code C++ compilers produces, incomprehensible error message, unstable tooling, and very long compilation times.
- simonask 1y agoWhat year is it, 1998? Am I going crazy? I think you're making some extraordinary claims. I'd love to see some receipts. :-)
- uecker 1y agoWhat specific claim do you think is extraordinary: That embedded programmers still often use C, that compilation times for C++ are often very long, that the languages is less stable than C, or that code produced by C++ can be worse?
- simonask 1y agoEspecially the last claim seems (that code generation for C++ is worse). It's the same compiler backend in all major compilers. Do you have any examples?
- throw-qqqqq 1y agoPurely guessing, but the "unstable tooling" could perhaps refer to the fact that C++ as a language has evolved a lot. I have had trouble compiling older C++ code bases with newer compilers, even when specifying C++98 as source standard. I gave up trying to get Scott McPeak's Elkhound C++ parser to compile, last I had to attempt it. C is a bit more forgiving on that topic (it hasn't changed as much, for better or worse).
- pjmlp 1y agoI assume you are not using GCC or clang for compiling C code, given that are garbage compilers written in C++. Still using tcc, or stuck in GCC 5 ?
- uecker 1y agoGCC was written in C but changed to C++ later. A lot of the code still looks a lot like C. And as a contributor, I would much prefer it was purely C (and compilation times for GCC itself are a pain - although I think this is not because of C++ but because some files grew to big and some refactoring would be in order)
- pjmlp 1y agoDoesn't the change the fact that by now being written in C++, generates garbage code, as per your own words, thus unsuitable for consumption in C projects.
- throw-qqqqq 1y ago> … there is hardly a modern 16 bit CPU that doesn't have a C++ compiler There are quite a few besides various PICs AFAIK, how modern they are is subjective I guess, and it IS mostly the weaker chips. Keil, Renesas, NXP, STMicro (STM8 MCUs used to be C only, not sure today) all sell parts where C++ is unsupported. > Nowadays the only reason many embedded developers keep using C is religous. I don’t completely agree, but I see where you are coming from. The simplest tool that gets the job done is often the best IMO. In my experience, it is much more difficult to learn C++ well enough to code safely, compared to C. Many embedded developers are more EE than CS, so simpler software is often preferred. I know you don’t have to use all the C++ features, all at once, but still :) Horses for courses. I prefer C for anything embedded.