General > General Technical Chat
How many people code in C these days, and if so, why?
IanB:
I think the last time I wrote any code for a C compiler was about 20 years ago. Since then, using C++ has just been more convenient. After using C++, C just seems too painful and restrictive.
There are often coding discussions here, where people seem to be talking about "C", but I'm not sure if everyone is being precise in their language, or if they may actually be using a C++ compiler? For instance, Visual Studio technically has a C compiler, but it is somewhat hidden and you have to take special steps to invoke it.
If you do write in C these days, what is the reason? Is it because there is no C++ compiler for your target hardware, or are there special advantages to C that make you prefer it?
Yansi:
This thread should be locked. NOW.
Warhawk:
--- Quote from: IanB on May 03, 2020, 03:42:33 pm ---I think the last time I wrote any code for a C compiler was about 20 years ago. Since then, using C++ has just been more convenient. After using C++, C just seems too painful and restrictive.
There are often coding discussions here, where people seem to be talking about "C", but I'm not sure if everyone is being precise in their language, or if they may actually be using a C++ compiler? For instance, Visual Studio technically has a C compiler, but it is somewhat hidden and you have to take special steps to invoke it.
If you do write in C these days, what is the reason? Is it because there is no C++ compiler for your target hardware, or are there special advantages to C that make you prefer it?
--- End quote ---
Code what? I've been in the industry for more than 10 years and have never seen anything else but C (with small exceptions such as ASM and C++) for embedded applications. And I am talking about quite big projects for industrial automation and automotive. In my opinion, C offers a good balance between portability, readability, comfort, and the level of abstraction between the hardware and software. More sophisticated language, higher the level of abstraction, and less control of the hardware. This is a big deal for realtime applications. I like that I can open the ASM listing and C side-by-side and see how my code works.
So my two cents - C for embedded, Python for "getting things done".
Karel:
I find C++ a horrible language, so I use plain C most of the time.
For GUI development I use Qt which is a C++ framework. This requires to use C++ and classes.
But I only write the bare minimum of C++, necessary to use Qt.
Fortunately you can write pure C code in .cpp files and it will compile fine (most of the time!).
Also, many modules that have nothing to do with the GUI, are in plain C and contain lines like:
--- Code: ---#ifdef __cplusplus
extern "C" {
#endif
--- End code ---
This way I can write real plain C code also in Qt (C++) projects.
maginnovision:
I mostly use C++ because it's easier and cleaner to get some things done. I use C a lot for some smaller projects and projects where C++ is really not an option. One processor I work with the linker chokes on C++ generated intermediate files constantly so it's basically not allowed unless you want to figure out which parts of the C++ code it didn't like.
Navigation
[0] Message Index
[#] Next page
Go to full version