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

0 Members and 3 Guests are viewing this topic.

Offline 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 #100 on: May 06, 2020, 10:06: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.
Python in VS? Not that I know. And I agree, VS as a development environemnt is a lot classier than IDLE :).
But with MS you never know. When they see that Python is making it - they will incorporate it in VS. MS has become
completely pragmatic now about platforms and languages.

And for the MATLAB added price list strategy -  Yes, its a nuisance, and it drives people away. Its not free, its not open,
and many times the Python scientific stuff is even more advanced, and you can adapt and expand it.
 

Offline engrguy42

  • Frequent Contributor
  • **
  • Posts: 656
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #101 on: May 06, 2020, 10:09:46 pm »
Wow...

Now I can be with the cool guys  :D

Sounds like NumPy is good for math stuff like arrays and complex numbers?
- 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 engrguy42

  • Frequent Contributor
  • **
  • Posts: 656
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #102 on: May 06, 2020, 10:15:52 pm »
My first python program. I just guessed and it worked  :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 Picuino

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: es
    • Picuino web
Re: How many people code in C these days, and if so, why?
« Reply #103 on: May 06, 2020, 10:38:30 pm »
 :clap:
Be careful, Python is a language that you fall in love with.
 

Offline engrguy42

  • Frequent Contributor
  • **
  • Posts: 656
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #104 on: May 06, 2020, 10:41:57 pm »
Does it do the drag-n-drop UI stuff in VS? Windows and buttons and stuff?
- 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 #105 on: May 06, 2020, 10:51:50 pm »
Learn about PyQt 5 and Qt Designer
 

Offline engrguy42

  • Frequent Contributor
  • **
  • Posts: 656
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #106 on: May 06, 2020, 10:53:49 pm »
OOoooooo...

Yummy sine wave  :-+
- 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 radioactive

  • Regular Contributor
  • *
  • Posts: 173
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #107 on: May 06, 2020, 10:55:56 pm »
Just thought of a question that might be relevant and interesting to this thread.  What languages can you think of that don't rely on any other languages to be useful?  I think this may just be the question to ask.  Why C?  C is the language of the people who create stuff with software these days.  Early on it used to be that assembler was the way to go.  Since then, 'C' has been the default for a good reason.  It is where you start if you want to create something efficient, new, experimental.  Sure, maybe something will replace it eventually.  I just can't see anything that looks better from my perspective in the here and now for embedded software development, OS development, and alternate language development.  Scripting languages are fads that come and go in my opinion.  Some are better than others.
 

Offline emece67

  • Frequent Contributor
  • **
  • !
  • Posts: 614
  • Country: 00
Re: How many people code in C these days, and if so, why?
« Reply #108 on: May 06, 2020, 11:41:16 pm »
.
« Last Edit: August 19, 2022, 03:48:49 pm by emece67 »
 

Offline engrguy42

  • Frequent Contributor
  • **
  • Posts: 656
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #109 on: May 07, 2020, 12:26:44 am »
ARRRRGGGGHHHH....

I've installed every freakin' PyQt5 related package I can find, including PyQt5Designer into Visual Studio, and for the life of me I can't figure out how to run Designer. There's a new tab in VS called "Qt VS Tools", and has an item "Launch Qt Designer", but when I select it it says "No default Qt version found", and wants me to fix my Tools settings. But I can't find any "Qt" anything on my machine. But in the Python Environments it shows PyQt5Designer (5.14.1) as an installed package, along with a ton of other packages.

This is what I hate about this stuff. There's so many freakin' versions of stuff that you can't find any tutorials or videos on this stuff. Oh, this one's for C++. And this one's not for VS. And NONE of them are for Qt Designer.

 |O

That's one thing I like about VS and C#/C++, it's all native stuff that works. Here you have to go futzing around with Qt whatever.

EDIT: Oh wait, I searched and found pyqt5designer.exe in ProgramFiles(x86)/Microsoft Visual Studio/Shared/Python36_64/Scripts

WTF???
« Last Edit: May 07, 2020, 12:30:23 am 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 maginnovision

  • Super Contributor
  • ***
  • Posts: 1966
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #110 on: May 07, 2020, 05:38:50 am »
For C++ gui stuff I usually run fltk and opengl. Typically good cross platform code even though you need to manually scale for dpi. I really don't want my code attached to a library and it's difficult to disconnect running QT.
 

Online nfmax

  • Super Contributor
  • ***
  • Posts: 1581
  • Country: gb
Re: How many people code in C these days, and if so, why?
« Reply #111 on: May 07, 2020, 07:44:34 am »
Probably a certain truth to that, frigging language would not keep still for long enough for you to actually finish anything....

C++ has some good bits, but it is such a vast sprawling mess these days that every engineer knows a DIFFERENT 20% of the language, for me it suffers from not being high level enough to be really efficient for GUI and suchlike work (Where you really want OO), while being just too big and with far too many footguns to make it attractive for small things.

That and the fact that on most platforms there is ONE C ABI, while C++ seems to have many depending in subtly ways on compiler options... Makes library things harder then they need to be.

C for low level or where speed matters, something MUCH higher level for GUI and suchlike bullshit.
C++ is a language that tries to do too much, and succeeds
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23059
  • Country: gb
Re: How many people code in C these days, and if so, why?
« Reply #112 on: May 07, 2020, 07:54:04 am »
Only because there’s a language feature and chapter on redefining success in Stroustrop’s book.  :-DD
 

Offline 0db

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: zm
Re: How many people code in C these days, and if so, why?
« Reply #113 on: May 07, 2020, 08:19:34 am »
Well, there is also something like the 'right person for the job' who can handle the right tool for the job.

Agree, and it's also context-dependent.
 

Offline 0db

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: zm
Re: How many people code in C these days, and if so, why?
« Reply #114 on: May 07, 2020, 08:24:18 am »
For C++ gui stuff I usually run fltk and opengl.

Even deep machine Learning is usually C++ stuff. A good choice, in both cases.
 

Offline ace1903

  • Regular Contributor
  • *
  • Posts: 237
  • Country: mk
Re: How many people code in C these days, and if so, why?
« Reply #115 on: May 07, 2020, 10:14:31 am »
Maybe a clarification is needed.
I do program in C for monthly salary all day long.
When I need to do some data processing, to interpret measurement results, test algorithm for signal processing I do use MATLAB, Python, Qt and C++.
Rarely Perl, TCL/TK, Java, Assembler ...

Somehow whole thread went in a direction to show how one can do something with few lines of code.
That is not coding, it is fun.

How many of you earn a salary by coding in Python(except web development), Matlab ,Octave...?
How many of you worked on code in Matlab Python larger than 1000 lines and potentially saleable?
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 5012
  • Country: si
Re: How many people code in C these days, and if so, why?
« Reply #116 on: May 07, 2020, 10:56:27 am »
Both C++ and Python are great languages but with entirely different purposes.

Id say people that earn a living programing in Python mostly use it as a way to process data or create quick small tools to get there actual job done. You wouldn't create a python application and sell it as PC software. Its a slow clumsy language that is not suited for large projects at all. But for when you want to write an app for example "takes in a folder full of images, rescales them and adds text in the corner according to data from a database" then you will have your app working from scratch in half an hour with Python. Its designed to let you do whatever you want without being a language nazzi and yelling at you "You can't put a string in there, this is a int array" it always tries to do whatever you tell it to do. As a result there is a lot of dirty tricks and bad programing habits in it, and big projects like to become a mess. Yet damn is it quick to throw something together in Python.

For developing GUI PC apps id recommend C#. It just works from VisualStudio and the language has a lot of object oriented creature comforts while maintaining very high performance. Lots of commercial apps are written using it.

Regular C on PCs tho...no, just don't. There are so many better languages now. The C language is mostly a way more readable and useful version of assembler. Its fast and lets you do low level things. So its great for running on MCUs where you might only have a few KB of RAM, or when writing Windows/Linux drivers where you need the low level capabilities. Game engines still use quite a bit of C++ tho, since it can squeeze last remaining bits of performance out of a CPU when a good programmer does it.
 

Online coppice

  • Super Contributor
  • ***
  • Posts: 9154
  • Country: gb
Re: How many people code in C these days, and if so, why?
« Reply #117 on: May 07, 2020, 11:01:33 am »
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.
Is it really? Mono has been around for years, but if it is seeing significant use it must be in places I never see.
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23059
  • Country: gb
Re: How many people code in C these days, and if so, why?
« Reply #118 on: May 07, 2020, 11:04:25 am »
Microsoft is telling everyone it is growing constantly and rolling out the marketing hard. It's shrinking almost everywhere in reality.
 

Offline engrguy42

  • Frequent Contributor
  • **
  • Posts: 656
  • Country: us
Re: How many people code in C these days, and if so, why?
« Reply #119 on: May 07, 2020, 11:06:27 am »
At this point I tend to agree with Berni. You start up VS, start a C# app, the toolbox with all the GUI stuff appears, you drag-n-drop, and you're off. The code is automatically generated, as are the event handlers.

Trying to shoehorn Python/Qt/Qt Designer into VS is looking like a pain, especially when GUI's are involved. Apparently you need to run QtDesigner separately to generate the .ui file, then use command line crap to convert to .py, and merge your code into that.

For those who have gone thru the hassle and it's become second nature, then yeah, it's easy. For those who have no interest in going thru the hassle, it's a freakin' pain. And at the end of the day, is there really much benefit over C#? Or is it just because it's popular? I couldn't care less what others are using, and whether it's "popular".

From what I've seen so far it's a "loose" version of C#.

In any case, does anyone know of a tutorial on setting up PyQt5 and QtDesigner, for Python, in Visual Studio, that's more recent than 6 years ago?
« Last Edit: May 07, 2020, 11:08:11 am 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 Berni

  • Super Contributor
  • ***
  • Posts: 5012
  • Country: si
Re: How many people code in C these days, and if so, why?
« Reply #120 on: May 07, 2020, 11:10:52 am »
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.
Is it really? Mono has been around for years, but if it is seeing significant use it must be in places I never see.

Well alone the game Fortnight generated about 2 billion USD of profit in 2019 and is running on the UnrealEngine where most of the actual game code is C# running in Mono for multiplatform. And this is just one example. Lots of games are made with UnrealEngine or Unity and both use Mono to run C# code on Windows, Linux, Mac, Android, iPhone...

Id say that is a pretty damn big use of Mono.

 

Online Kosmic

  • Super Contributor
  • ***
  • Posts: 2552
  • Country: ca
Re: How many people code in C these days, and if so, why?
« Reply #121 on: May 07, 2020, 12:46:57 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.
Is it really? Mono has been around for years, but if it is seeing significant use it must be in places I never see.

Well alone the game Fortnight generated about 2 billion USD of profit in 2019 and is running on the UnrealEngine where most of the actual game code is C# running in Mono for multiplatform. And this is just one example. Lots of games are made with UnrealEngine or Unity and both use Mono to run C# code on Windows, Linux, Mac, Android, iPhone...

Id say that is a pretty damn big use of Mono.

FYI this is not true. UnrealEngine 4 is mostly C++ (100% of the runtime engine and a good chuck of the tools). Nobody remotely serious use C# and mono in a video game.

If you don't believe me just d/l the source code of UE4...
« Last Edit: May 07, 2020, 12:48:32 pm by Kosmic »
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 5012
  • Country: si
Re: How many people code in C these days, and if so, why?
« Reply #122 on: May 07, 2020, 01:16:16 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.
Is it really? Mono has been around for years, but if it is seeing significant use it must be in places I never see.

Well alone the game Fortnight generated about 2 billion USD of profit in 2019 and is running on the UnrealEngine where most of the actual game code is C# running in Mono for multiplatform. And this is just one example. Lots of games are made with UnrealEngine or Unity and both use Mono to run C# code on Windows, Linux, Mac, Android, iPhone...

Id say that is a pretty damn big use of Mono.

FYI this is not true. UnrealEngine 4 is mostly C++ (100% of the runtime engine and a good chuck of the tools). Nobody remotely serious use C# and mono in a video game.

If you don't believe me just d/l the source code of UE4...

Well yes the engines themselves are are written in C++, but C# is one of the popular languages that is ran on top for actual game code. Okay yes UnrealEngine does favor C++ for game code too, but you can use any language that can compile itself into a dynamic library. Unity is just as big of a player in the game engine scene and it heavily pushes C# due to tightly it is integrated with it (So yes large parts of Unity are also written in C# to facilitate that, but the core parts of the engine are not).

These non compiled languages are attractive for the reason that they run on any platform out of the box and they offer a lot of rich debugging functionality regardless of platform. A lot of the time these modern game engines even allow for modification of code as its running live (even when running on a remote system like an Xbox or PS4). So it makes sense to use things like C# for game code in order to speed up development. Later on this also becomes usefull for any moding API pr plugins as they can tap into the code on a high level rather than essentially acting like a virus to tap into functions and memory.

Yes you would not write an entire game in C#, but quite a lot games released in the last 10 years are running the high level game logic inside Mono due to the benefits that JIT compiled languages offer.
 

Online Kosmic

  • Super Contributor
  • ***
  • Posts: 2552
  • Country: ca
Re: How many people code in C these days, and if so, why?
« Reply #123 on: May 07, 2020, 01:31:45 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.
Is it really? Mono has been around for years, but if it is seeing significant use it must be in places I never see.

Well alone the game Fortnight generated about 2 billion USD of profit in 2019 and is running on the UnrealEngine where most of the actual game code is C# running in Mono for multiplatform. And this is just one example. Lots of games are made with UnrealEngine or Unity and both use Mono to run C# code on Windows, Linux, Mac, Android, iPhone...

Id say that is a pretty damn big use of Mono.

FYI this is not true. UnrealEngine 4 is mostly C++ (100% of the runtime engine and a good chuck of the tools). Nobody remotely serious use C# and mono in a video game.

If you don't believe me just d/l the source code of UE4...

Well yes the engines themselves are are written in C++, but C# is one of the popular languages that is ran on top for actual game code. Okay yes UnrealEngine does favor C++ for game code too, but you can use any language that can compile itself into a dynamic library. Unity is just as big of a player in the game engine scene and it heavily pushes C# due to tightly it is integrated with it (So yes large parts of Unity are also written in C# to facilitate that, but the core parts of the engine are not).

So for UE4, again no this is not true. A C# .dll is really different than a C++ .dll. You can't really plug a c# .dll in a c++ application (the reverse is possible though). You need a CLR to run c# code. UE4 do not contain a CLR and run exclusively C++ code.

Also about .dll, on consoles (xbox, playstation) .dll are possible but are still not immensely popular. A huge monolithic executable is still preferred by the 1st party (Microsoft and Sony).

These non compiled languages are attractive for the reason that they run on any platform out of the box and they offer a lot of rich debugging functionality regardless of platform. A lot of the time these modern game engines even allow for modification of code as its running live (even when running on a remote system like an Xbox or PS4). So it makes sense to use things like C# for game code in order to speed up development. Later on this also becomes usefull for any moding API pr plugins as they can tap into the code on a high level rather than essentially acting like a virus to tap into functions and memory.

This is also not true. C# is a compiled language and it's not interpreted like python. Like Java it's compiled to an intermediary language that most of the time really look like x86 assembly. The IL then run in a runtime environment adapted to the targeted platform. So the idea is that your business code in IL stay agnostic of the platform.

Yes you would not write an entire game in C#, but quite a lot games released in the last 10 years are running the high level game logic inside Mono due to the benefits that JIT compiled languages offer.

Like I said Mono and even Microsoft CLR are far too slow to run a game. Even in Unity, which use C#, they created a C# IL code converter (IL2CPP) to be able to convert your C# code in C++. The C++ code is then compiled natively to suit the targeted platform. I think the only exception is Windows PC where some game are kept C# over Mono or MS CLR. All other platforms (Phones, Xbox, Playstation) run native code.

Overall C# in a game is a really bad idea. The trend right now is to create a Visual Scripting language like Blueprint in UE4. The Visual Scripting language run on top of C++ and performance can be managed.
« Last Edit: May 07, 2020, 02:07:09 pm by Kosmic »
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 5012
  • Country: si
Re: How many people code in C these days, and if so, why?
« Reply #124 on: May 07, 2020, 04:16:31 pm »
Yes i know there are differences between a machine code DLL and a CLR DLL. But UE4 will handle it with a simple plugin.

And yes C# is indeed not interpreted directly like Python. Its crunched into the .Net IL and this is then JIT compiled to platform specific machine code on the fly. This is the reason why C# is actually really fast, it only needs to be compiled once, then the code is essentially machine code. Sure it might not be the C level of performance, but its not that far behind. Hence why it does end up used in games so often. Most of the complex gameplay related game code is not being executed all the time so it does not matter if the code runs half as fast as it could in C++, it won't run often enough to visibly degrade performance, yet the creature comforts of the C# language make its development and troubleshooting significantly faster (this game logic is often a lot more complex in terms of many more variations in behavior, more variables etc). Games are huge and have long load times so recompiling a game for each test run is not desirable. For this reason a lot of games in the last 30 years have some sort of non precompiled language inside it(Lua used to be popular for this), it makes game development easier, since the non programmer person plonking down game NPCs can just quickly edit a file in notepad while the game is running. The only difference with C# is that its the first such popular language that is performant enough to be used for a lot more than just simple NPC behavior scripts that run once every few seconds. Go have a look at some C++ vs C# benchmarks and see how close to C++ performance it actually is.

I have looked at my Steam install directory and out of the 40 games installed 19 of those games had a folder named "mono" full of windows mono dll files. So it is safe to say a significant part of games make use of of it. Tho by now core.Net is replacing mono by doing the same job.

Still yes you would not write the entire game engine in C#. You do want all the performance you can get out of the low level loading and rendering functions, you want native calling of other native DLLs etc. But for high level game logic the small performance penalty is really not a big deal as its so small that the other benefits make up for it. Besides the big AAA publishers that do make there own C++ engines end up slapping ever larger DRM methods (decrypting the machine code as its running) and this results in very significant drops in performance of 10 to 50% in tests (People got there hands on a DRM free version of the same game to compare the DRM impact)

My point is that non C++ languages are used a lot in game development because they have advantages that outweigh the performance cost. They are still not a replacement for C++. But for the usual one man band engineer writing software to run on a PC with GUI the whole C++ thing is usually not a good fit. The slight performance gain is not justified by the extra time, effort and expertise required. If raw performance was the main metric then everyone would still be doing assembler.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf