Author Topic: How many people code in C these days, and if so, why?  (Read 45400 times)

0 Members and 5 Guests are viewing this topic.

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27527
  • Country: nl
    • NCT Developments
Re: How many people code in C these days, and if so, why?
« Reply #75 on: May 06, 2020, 07:25:32 pm »
Its generally not smart to mingle OO and real time. Reason: OO resource management is somehow unpredictable and might add uncalculatable runtime when you cant afford it.
No usable OS kernel I know is written in an OO language. Not even Windows :)
But that is more due to religion than due to common sense. Also a lot of OSses stem from before C++ was commonly used.

If you look at the Linux kernel for example I'm 100% sure it will run faster when it is written in C++ because the compiler can optimise much more compared to regular C. For example: A regular C compiler can't inline functions which are pointed to by a function pointer. In C++ the compiler can do that if that function pointer never changes.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online Wolfgang

  • Super Contributor
  • ***
  • Posts: 1810
  • Country: de
  • Its great if it finally works !
    • Electronic Projects for Fun
Re: How many people code in C these days, and if so, why?
« Reply #76 on: May 06, 2020, 07:32:31 pm »
the const attribute is available in plain C too nowadays, IIRC.

Its just a matter of safety; In C you can almost guess what assembly will come out of it. In OO code with overloaded functions,
multiple inheritance, ... its hard to optimize, not very safe and transparent. I would not trust that in mission critical cores, IMHO.
 

Offline Picuino

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: es
    • Picuino web
Re: How many people code in C these days, and if so, why?
« Reply #77 on: May 06, 2020, 07:37:49 pm »
I think the ideal is to combine the best of each world. C to make quick and efficient code libraries combined with a scripting language like
Python, Lua or TCL to develop the application at a high level. Many software packages do so today.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27527
  • Country: nl
    • NCT Developments
Re: How many people code in C these days, and if so, why?
« Reply #78 on: May 06, 2020, 07:40:15 pm »
the const attribute is available in plain C too nowadays, IIRC.

Its just a matter of safety; In C you can almost guess what assembly will come out of it. In OO code with overloaded functions,
multiple inheritance, ... its hard to optimize, not very safe and transparent. I would not trust that in mission critical cores, IMHO.
It is only hard to optimise if an object is linked in runtime (runtime polymorfism for exampe) but other than that relations are 100% known during compile time.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23059
  • Country: gb
Re: How many people code in C these days, and if so, why?
« Reply #79 on: May 06, 2020, 08:14:57 pm »
I think the ideal is to combine the best of each world. C to make quick and efficient code libraries combined with a scripting language like
Python, Lua or TCL to develop the application at a high level. Many software packages do so today.

Spot on. Exactly that.  :-+

Also glad to see TCL mentioned in 2020  :-+
 

Online coppice

  • Super Contributor
  • ***
  • Posts: 9151
  • Country: gb
Re: How many people code in C these days, and if so, why?
« Reply #80 on: May 06, 2020, 08:18:12 pm »
I think the ideal is to combine the best of each world. C to make quick and efficient code libraries combined with a scripting language like
Python, Lua or TCL to develop the application at a high level. Many software packages do so today.
Its a long time since I saw anything but legacy code in TCL. It (or more specifically TCL/TK) used to be extremely popular for some pretty complex applications.
 

Offline Picuino

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: es
    • Picuino web
Re: How many people code in C these days, and if so, why?
« Reply #81 on: May 06, 2020, 08:27:34 pm »
Tcl was just an example of scripting language. I know it from Tcl / Tk in Python.
« Last Edit: May 06, 2020, 08:29:05 pm by Picuino »
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15044
  • Country: fr
Re: How many people code in C these days, and if so, why?
« Reply #82 on: May 06, 2020, 08:29:18 pm »
Personally I'm not a fan of doing OO in plain C. C++ makes life a lot easier by hiding all the nasty stuff which results in much easier to read code. The Linux kernel is a particular poor example of doing OO in C. It is a huge convoluted mess.

It works well enough and has been maintained for a long time, for something that is a huge convoluted mess. But code style is such a personal matter.

Anyway. You'll use more basic OO approaches with plain C, but if done right, it structures things well, and contrary to C++ (which granted has a lot more features and sugar coating), it's still perfectly predictable, so it's often a benefit especially for embedded stuff.

Now it may depend on what exactly YOU call OO.
 

Offline engrguy42

  • Frequent Contributor
  • **
  • Posts: 656
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #83 on: May 06, 2020, 08:43:45 pm »
I'm kinda surprised in an engineering forum nobody is talking about C#. For general engineering stuff like simulations and setting up UI's and graphs and data acquisition stuff it is, for me at least, incredibly fast and efficient to get stuff up and running. Just drag-n-drop some UI components (windows, buttons, graphs, etc.), grab a free math library like MathNet, write your code and you're all set. And personally, like I say, if you're simulating real world equipment the OO design makes things so intuitive.

Is it because many folks here are more involved with hardware/embedded systems?

And also no mention of the ever popular graphics/gaming stuff that pretty much relies on C++ for the API's (DirectX, OpenGL, etc.). I've been doing raytracing stuff in OpenGL/C++ and it seems like most of the docs and sample code and tutorials are geared toward C++. 
- The best engineers know enough to realize they don't know nuthin'...
- Those who agree with you can do no wrong. Those who disagree can do no right.
- I'm always amazed at how many people "already knew that" after you explain it to them in detail...
 

Online Wolfgang

  • Super Contributor
  • ***
  • Posts: 1810
  • Country: de
  • Its great if it finally works !
    • Electronic Projects for Fun
Re: How many people code in C these days, and if so, why?
« Reply #84 on: May 06, 2020, 08:52:16 pm »
IMHO, the reason for the preference of Python is because:
- cross-platform
- much more scientific/engineering libs than other languages
- free, and open source.
Hard to beat, I would say. When you look at TIOBE what is happening to MATLAB at the moment that tells something.
Python is on the way to a firm number one in scientific computing, also for AI, ...
 

Offline radioactive

  • Regular Contributor
  • *
  • Posts: 173
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #85 on: May 06, 2020, 08:55:37 pm »
Quote
Someone's right tool maye be someone else's worst nightmare - for the exact same project.

I feel as though you are referring to Python here.  Either that,  or possibly my personal nightmares.  I guess the former makes more sense.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27527
  • Country: nl
    • NCT Developments
Re: How many people code in C these days, and if so, why?
« Reply #86 on: May 06, 2020, 08:59:55 pm »
Personally I'm not a fan of doing OO in plain C. C++ makes life a lot easier by hiding all the nasty stuff which results in much easier to read code. The Linux kernel is a particular poor example of doing OO in C. It is a huge convoluted mess.
It works well enough and has been maintained for a long time, for something that is a huge convoluted mess. But code style is such a personal matter.
I don't know your knowledge level with the Linux kernel but I'm intimately familiar with it. Making meaningful modifications to it has a steep learning curve and there is a of lot stuff loosely coupled using void pointers. From a C point of view defendable but from a coding perspective it doesn't help.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27527
  • Country: nl
    • NCT Developments
Re: How many people code in C these days, and if so, why?
« Reply #87 on: May 06, 2020, 09:03:29 pm »
I'm kinda surprised in an engineering forum nobody is talking about C#. For general engineering stuff like simulations and setting up UI's and graphs and data acquisition stuff it is, for me at least, incredibly fast and efficient to get stuff up and running. Just drag-n-drop some UI components (windows, buttons, graphs,
C# is MS only. People seem to use Python for that kind of applications nowadays. Personally I don't know anyone who is writing software using C#.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online Wolfgang

  • Super Contributor
  • ***
  • Posts: 1810
  • Country: de
  • Its great if it finally works !
    • Electronic Projects for Fun
Re: How many people code in C these days, and if so, why?
« Reply #88 on: May 06, 2020, 09:08:24 pm »
Personally I'm not a fan of doing OO in plain C. C++ makes life a lot easier by hiding all the nasty stuff which results in much easier to read code. The Linux kernel is a particular poor example of doing OO in C. It is a huge convoluted mess.
It works well enough and has been maintained for a long time, for something that is a huge convoluted mess. But code style is such a personal matter.
I don't know your knowledge level with the Linux kernel but I'm intimately familiar with it. Making meaningful modifications to it has a steep learning curve and there is a of lot stuff loosely coupled using void pointers. From a C point of view defendable but from a coding perspective it doesn't help.
my Linux kernel area is years gone. The problem is rather that it has never been *really* cleaned up and rewritten. Its like all successful software: it can be incrementally improved until it finally breaks down. 20 years leave their trace in any kind of software.
The problem we had that we wrote software that our customers did not want to renovate after 20 years or more. None of our developers was keen to work inside the code, even it was very clean (in the beginning). Same with Linux or any other "old" OS.
 

Offline engrguy42

  • Frequent Contributor
  • **
  • Posts: 656
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #89 on: May 06, 2020, 09:08:40 pm »
IMHO, the reason for the preference of Python is because:
- cross-platform
- much more scientific/engineering libs than other languages
- free, and open source.
Hard to beat, I would say. When you look at TIOBE what is happening to MATLAB at the moment that tells something.
Python is on the way to a firm number one in scientific computing, also for AI, ...

Hey, wait a minute...what's happening to MATLAB???

Am I gonna have to learn Python??  :D
- The best engineers know enough to realize they don't know nuthin'...
- Those who agree with you can do no wrong. Those who disagree can do no right.
- I'm always amazed at how many people "already knew that" after you explain it to them in detail...
 

Online IanBTopic starter

  • Super Contributor
  • ***
  • Posts: 12197
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #90 on: May 06, 2020, 09:10:32 pm »
C# is MS only. People seem to use Python for that kind of applications nowadays. Personally I don't know anyone who is writing software using C#.

C# is gaining cross-platform support and much of it is now open.

As for writing software in C# -- over here! ::waves hand::  ;D
 

Offline engrguy42

  • Frequent Contributor
  • **
  • Posts: 656
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #91 on: May 06, 2020, 09:10:51 pm »
I'm kinda surprised in an engineering forum nobody is talking about C#. For general engineering stuff like simulations and setting up UI's and graphs and data acquisition stuff it is, for me at least, incredibly fast and efficient to get stuff up and running. Just drag-n-drop some UI components (windows, buttons, graphs,
C# is MS only. People seem to use Python for that kind of applications nowadays. Personally I don't know anyone who is writing software using C#.

No offense, but one guy not knowing a C# user doesn't say much. I just checked and it's said there are over 6 million users.

Maybe you need to get out more  :D
- The best engineers know enough to realize they don't know nuthin'...
- Those who agree with you can do no wrong. Those who disagree can do no right.
- I'm always amazed at how many people "already knew that" after you explain it to them in detail...
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23059
  • Country: gb
Re: How many people code in C these days, and if so, why?
« Reply #92 on: May 06, 2020, 09:11:02 pm »
I'm kinda surprised in an engineering forum nobody is talking about C#. For general engineering stuff like simulations and setting up UI's and graphs and data acquisition stuff it is, for me at least, incredibly fast and efficient to get stuff up and running. Just drag-n-drop some UI components (windows, buttons, graphs, etc.), grab a free math library like MathNet, write your code and you're all set. And personally, like I say, if you're simulating real world equipment the OO design makes things so intuitive.

Is it because many folks here are more involved with hardware/embedded systems?

I have written a fair bit of C# over the years. In fact there are a few programs attached to my posts on here. You're right for rapid development purposes it's good. It also scales really well vertically and across teams. The main products I worked on over the last 15 years or so were C#.

But that's where the love ends I'm afraid. The language is fine but the mismanagement by microsoft of all the frameworks over the years has put a hell of a lot of us off. On top of that we have the shit show which is .Net Core that appeared on the scene. Really the issue stems from the closed nature of the ecosystem initially where you'd get pulled through microsoft "patterns and practices" which gave you terrible architectural advice and frameworks and then left you high and dry when their direction changed. Then along came the SOA era where they kicked out stuff like WCF, WWF and AppFabric. Within 3 years they pulled most of that and migrated to the whole Web API ecosystem, abandoning swathes of enterprise customers. Then there was the Silverlight debacle and the Windows Phone "throw everything away and start again" transition between WP7 and WP8. People were starting to get pissed. Then the Compact Framework and Windows Embedded were abandoned which left hoardes of mid-tier enterprises up shit creek. As if that wasn't enough of a kick in the teeth, about that time the ecosystem license costs got cranked up and other platforms started getting a lot of interest. Their result was to recycle the original Rotor CLR as .Net core and make it cross platform, an easy enough job apart from all the shitty bits of cruft that were win32 specific. Some effort was made at compatibility (.Net standard) but it means a rewrite for a lot of people. Even large components like NHibernate have non-portable forward changes.  In the background all the open source projects were being abandoned out of disinterest because the ecosystem is relatively small compared to others. Literally by the time everyone had ported to .Net Core 2.0, the world was on .Net core 3.1 and there was more heavy lifting and cost to throw at the problem. At the same time there was massive API consolidation and growth leading to a simpleish console application with logging pulling in a metric shit ton of dependencies. The last desperate breath is "we're going to get it right with .Net 5 and oh by the way can you bend over some more because your legacy SQL cluster is going to be buggered for a cool £1 million this year". Deep breath and look at the universe...

The C guys are raising one eyebrow because nothing changed in the last 15 years.

The Go guys are raising one eyebrow because the last major version upgrades they did in the last 10 years were trivial and automated.

The Python guys waited until all their libraries were ported, ran 2to3 and carried on in the last 10 years.

The postgres guys are sitting there laughing at this.

Everyone in the .Net ecosystem saw the guys above and said they want some of that. All the remains is a few scarred corpses like myself propping up what is left and whining on github and being silenced every time we even try and deal with MSFT who are really shitting out the marketing hard and shutting down negative sentiment and anything which questions their totalitarian control of the "open source" projects they run. Which is why C# is dying on it's arse at the moment. Even the company I work for which is a stallwart MS partner for many years is a Linux shop now. The legacy shit runs on .Net Core. The new stuff is going out in python and Go on Linux on AWS. It's dying. Run away quick.

Microsoft's development ecosystem is shiny as fuck but it's not something I would consider building a business on at this time. It's expanding out of desparation, nothing more. What exists past trivial stuff is a money sink.
« Last Edit: May 06, 2020, 09:13:06 pm by bd139 »
 
The following users thanked this post: nctnico, mnementh

Offline radioactive

  • Regular Contributor
  • *
  • Posts: 173
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #93 on: May 06, 2020, 09:12:49 pm »
IMHO, the reason for the preference of Python is because:
- cross-platform
- much more scientific/engineering libs than other languages
- free, and open source.
Hard to beat, I would say. When you look at TIOBE what is happening to MATLAB at the moment that tells something.
Python is on the way to a firm number one in scientific computing, also for AI, ...

Hey, wait a minute...what's happening to MATLAB???

Am I gonna have to learn Python??  :D

No,  it is just another C library that someone created bindings to in Python.  Don't worry.
 

Online Wolfgang

  • Super Contributor
  • ***
  • Posts: 1810
  • Country: de
  • Its great if it finally works !
    • Electronic Projects for Fun
Re: How many people code in C these days, and if so, why?
« Reply #94 on: May 06, 2020, 09:30:24 pm »
IMHO, the reason for the preference of Python is because:
- cross-platform
- much more scientific/engineering libs than other languages
- free, and open source.
Hard to beat, I would say. When you look at TIOBE what is happening to MATLAB at the moment that tells something.
Python is on the way to a firm number one in scientific computing, also for AI, ...

Hey, wait a minute...what's happening to MATLAB???

Am I gonna have to learn Python??  :D

yeah, maybe not the worst idea. The point is that in Python most of engineering and math you need works similarly or sometimes even better than MATLAB, and Python is free. MATLAB not at all.
TIOBE shows that MATLAB use is declining steeply, Python is growing at record speed.
 

Offline engrguy42

  • Frequent Contributor
  • **
  • Posts: 656
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #95 on: May 06, 2020, 09:41:24 pm »
IMHO, the reason for the preference of Python is because:
- cross-platform
- much more scientific/engineering libs than other languages
- free, and open source.
Hard to beat, I would say. When you look at TIOBE what is happening to MATLAB at the moment that tells something.
Python is on the way to a firm number one in scientific computing, also for AI, ...

Hey, wait a minute...what's happening to MATLAB???

Am I gonna have to learn Python??  :D

yeah, maybe not the worst idea. The point is that in Python most of engineering and math you need works similarly or sometimes even better than MATLAB, and Python is free. MATLAB not at all.
TIOBE shows that MATLAB use is declining steeply, Python is growing at record speed.

Oh really? MATLAB declining? Maybe because every time you need to do something you learn "oh, that's in this OTHER set of tools, and it will cost you another $50".  |O

But the good thing is they have some pretty nice pre-made models you can start with. Well, as long as you buy that OTHER set of Simulink/Simscape/whatever tools and spend another freakin' $250.

Damn. I guess "learn Python" goes on my to-do list....

Oh, BTW, does Visual Studio do Python? I love Visual Studio.
« Last Edit: May 06, 2020, 09:44:26 pm by engrguy42 »
- The best engineers know enough to realize they don't know nuthin'...
- Those who agree with you can do no wrong. Those who disagree can do no right.
- I'm always amazed at how many people "already knew that" after you explain it to them in detail...
 

Offline Picuino

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: es
    • Picuino web
Re: How many people code in C these days, and if so, why?
« Reply #96 on: May 06, 2020, 09:46:56 pm »
https://code.visualstudio.com/docs/languages/python
You should know Python at least as a complement to Matlab. Learning curve is very easy and fun.
 

Offline engrguy42

  • Frequent Contributor
  • **
  • Posts: 656
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #97 on: May 06, 2020, 09:53:03 pm »
https://code.visualstudio.com/docs/languages/python
You should know Python at least as a complement to Matlab. Learning curve is very easy and fun.

Oh wait, VS tells me I already have Python installed.  :D

But the downside is my tons of code and libraries I've already made in C# & C++ won't work anymore  :-\

Is there a magic converter thingy?
- The best engineers know enough to realize they don't know nuthin'...
- Those who agree with you can do no wrong. Those who disagree can do no right.
- I'm always amazed at how many people "already knew that" after you explain it to them in detail...
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23059
  • Country: gb
Re: How many people code in C these days, and if so, why?
« Reply #98 on: May 06, 2020, 09:58:57 pm »
Check pypi first. Most of the shit I've written over the years someone else has already put together something better for.
 

Offline radioactive

  • Regular Contributor
  • *
  • Posts: 173
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #99 on: May 06, 2020, 10:03:12 pm »
IMHO, the reason for the preference of Python is because:
- cross-platform
- much more scientific/engineering libs than other languages
- free, and open source.
Hard to beat, I would say. When you look at TIOBE what is happening to MATLAB at the moment that tells something.
Python is on the way to a firm number one in scientific computing, also for AI, ...

Hey, wait a minute...what's happening to MATLAB???

Am I gonna have to learn Python??  :D

yeah, maybe not the worst idea. The point is that in Python most of engineering and math you need works similarly or sometimes even better than MATLAB, and Python is free. MATLAB not at all.
TIOBE shows that MATLAB use is declining steeply, Python is growing at record speed.

Oh really? MATLAB declining? Maybe because every time you need to do something you learn "oh, that's in this OTHER set of tools, and it will cost you another $50".  |O

But the good thing is they have some pretty nice pre-made models you can start with. Well, as long as you buy that OTHER set of Simulink/Simscape/whatever tools and spend another freakin' $250.

Damn. I guess "learn Python" goes on my to-do list....

Oh, BTW, does Visual Studio do Python? I love Visual Studio.

I feel your pain.  I spent more than that on some "home" version to learn the *real* matlab instead of octave.  I thought it might give me some insight when I was first learning FPGA after putting it off for decades.  After downloading and playing around with it,  I realized that not only could I *not* do anything FPGA related with it, but the only thing it was slightly better at  (at the time) was creating coefficients for FIR filters.  I wrote my own code for that since then.  Last time I tried to run Matlab (that I paid $500 or so for from memory), it segfaulted.  I think the Octave project is the future of Matlab from what I can tell.  Also, Python uses lib-octave libraries from what I can tell (not that interesting to me).  I really can't stand even looking at Python code.  Maybe there is also some kind of commercial effort from the Matlab guys?  Not sure about that.

related sidenote: Also learned VHDL and Verilog since then.  Both well worth learning.  I came away from it preferring Verilog by far.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf