General > General Technical Chat
How many people code in C these days, and if so, why?
Kosmic:
--- Quote from: maginnovision on May 07, 2020, 09:47:16 pm ---Supposed to be arguing about C anyway, haha.
--- End quote ---
Back On topic,
I would say that I used C when the project was smaller and when resource efficiency was important. The problem with C (and even more with assembly) is the fact that they don't scale very well. It's possible to create a huge application with C but it's really hard and tricky to keep the control as the application is growing.
On the other side OOP and C++ give you some tools to scale your application but you end up being a bit less performant and efficient.
So for me, it's all about using the right tool for the right job. Personally, I tend to use C on MCU, C++ for big application that need performance and C# when I don’t really care about performance and I just want to do something quick (90% of what I’m doing at home)
dietert1:
As far as i understand, object oriented development is good for libraries and APIs (abstraction).
When i have to produce firmware for an embedded project, i rarely arrive at writing a library (e.g. operating system). But i may be using one. So in general it will be C++ nowadays. Though cpp files and a C++ compiler don't mean object oriented development.
Regards, Dieter
coppice:
--- Quote from: dietert1 on May 07, 2020, 10:45:23 pm ---As far as i understand, object oriented development is good for libraries and APIs (abstraction).
When i have to produce firmware for an embedded project, i rarely arrive at writing a library (e.g. operating system). But i may be using one. So in general it will be C++ nowadays. Though cpp files and a C++ compiler don't mean object oriented development.
Regards, Dieter
--- End quote ---
C++ is terrible for libraries. If you write a library in C it is trivial to make it callable from pretty much anything. If you write a library in C++ you need to be constrain yourself more or less to writing in C if you want to make it callable from a wide variety of other languages.
IanB:
--- Quote from: Kosmic on May 07, 2020, 10:03:27 pm ---On the other side OOP and C++ give you some tools to scale your application but you end up being a bit less performant and efficient.
--- End quote ---
There have been many comments in this thread about bloat and inefficiency, and why C++ is not suitable for low level hardware. It would take me a while to search back and find them all.
One comment by (I don't remember who) mentioned about non-deterministic behavior, and you don't know when things are going to happen (?), which is absolutely not a property of the C++ language. It doesn't have managed memory like Java or C#, there are no garbage collectors, and you do know exactly when memory will be allocated and de-allocated according to the standard. You have complete control over resources.
I just watched a very interesting presentation about coding for low level hardware in C++, about as close to the metal as you can get. It is worth a watch, as food for thought if nothing else.
dietert1:
--- Quote from: coppice on May 07, 2020, 11:51:27 pm ---
--- Quote from: dietert1 on May 07, 2020, 10:45:23 pm ---As far as i understand, object oriented development is good for libraries and APIs (abstraction).
When i have to produce firmware for an embedded project, i rarely arrive at writing a library (e.g. operating system). But i may be using one. So in general it will be C++ nowadays. Though cpp files and a C++ compiler don't mean object oriented development.
Regards, Dieter
--- End quote ---
C++ is terrible for libraries. If you write a library in C it is trivial to make it callable from pretty much anything. If you write a library in C++ you need to be constrain yourself more or less to writing in C if you want to make it callable from a wide variety of other languages.
--- End quote ---
I know there are other languages than C and C++. As i wrote before i rarely arrive at writing libraries, but i often use some. I guess that probably applies to most of the contributors here. Using C++ with STL is something very nice in comparison to old fashioned C style. But some won't ever understand.
Regards, Dieter
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version