r/cprogramming • u/[deleted] • Jan 19 '24
is c dying?
I am thinking if I want to learn c or c++ as my main language and while my heart tells me c my mind is unsure. it has to be 1 of these 2 because I want to write python ml extensions for gpus my plan was to learn c because:
its easier
better integrated with python
it seemed to have a better future.
while the first 2 remain true the last 1 I am not so sure
I have recently seen a discussion for moving Linux into c++ and python ml libararies are also starting to be made in c++. I am not really sure if any new projects are being made in c...
it may be that the distinction dosent matter and I should just learn both. which is probably anyway going to be the case but I was really hoping to fouces on c much more and now I am fairly unsure
20
u/IMTrick Jan 20 '24
C isn't going away any time soon, and pretty much anything you learn to do in C will be applicable to C++.
If you have plans to use any particular programming language, learn that. Otherwise, C is probably at least as good a foundation as any.
4
Jan 20 '24
i m on python for the last 2 years its probably going to be the backbone of most of what I do but I need an hpc option which will probably be a mix of c and c++ i hoped it could be JUST c.
tbh maybe I am overthinking it most hpc code is just simple arithmatic and loops and that makes both c and c++ look idntical sometimes I honestly cant tell which is which when reading a codebase.
5
u/alkatori Jan 20 '24
Why do you hope for just C?
C isn't going anywhere, since Fortran didn't and it's been on it's way out for like 50 years. While new things might choose C++ or rust, we have lots and lots of C code that will need to be maintained and isn't going anywhere.
1
Jan 20 '24
Well I wana work on new stuff. Like I work on ai and thats my pation. That's why I learned python that's why I m learning c.
I just don't like looking at c++ there just so much stuff to dive into.
3
u/alkatori Jan 20 '24
Not sure why you are down voted. You can personally dislike a language, I just wouldn't write it off.
I'm not a fan of Java, but I've written a lot of Java code. There's nothing inherently wrong with it, it's just somehow linked with college and I apparently didn't like something about it (maybe it were told not to use an IDE/Debugger). So even now that I've been exposed to the tools I'm still not a fan.
I would say - it's *worth* learning a language even if you don't particularly like it or plan on using it. Different languages have different "standard" approaches to figuring out problems. That helps you further on in your career.
I mostly work with C++/C#, a little bit of Python.
I'm familiar and have worked with Java, Lisp, PHP, ASP, C and probably another dozen "Here's something that needs attention for a week, and never touch again".
Now I'm playing with Rust at home, and working with QTQuick to get a feel for it.
2
Jan 20 '24
Well coming to the c sub and shitting on c and c++ is a good way to get down voted.
I did get a LOT of very useful insights into c c++ and coding in genral so I would say this is a huge win.
Ig I just need to let go of the idea that a languge could be perfect even if its for a very specific thing and just use stuff.
Just kinda got disheartened when I realised a lot of projects I care about moved to c++. Like I write ml Linux... both the kernal itself and the ml libraries have serious inclinations to shift to c++
Tho I think I mainly scared myself for no reason.
I was having a labguge journy and still am in a lot of ways. I did some elixir some c c++. Even some java for school.
I think I need to be more serious about c and c++ because that's what I would read when reading ml papers and that'd what I would use when integrating to ml libraries.
I do wana learn fortran too mostly for the memes of doing oop in fortran it seems kinda super ironic to me to do that and also really cool.
But it's all just so overwhelming rn I could somehow see myself learning c because its a simple small languge and I can wrap my head around it. It felt doble. c++ feels like it's a bug commitment and that it'd gona be too much.
2
u/alkatori Jan 20 '24
Don't try and wrap your head around the whole language. For C++ there are like 9 people on Earth that probably fully understand it.
Get some basics (C is a good starting point). Then as you dip in to C++ check and see if there is a preferred way to do 'X' in C++. So you don't end up with "C but with classes".
My current style of writing C++ code is class and functional. Most of the way schools teach C++ and OOP is IMO wrong. I prefer there to be a central area where state is controlled in each "area" which is a bit nebulous to define, rather than state spread amongst many classes.
I don't see Linux moving to C++. There is interest in Rust. I'm watching that because I'm interested in how that is going to go.
2
Jan 20 '24
Rust makes a lot more sense for an os imo but I did see some emails from linux kernal devs seriously talking about c++.
The main idea is to switch the hard and awful c macros they are using g rn with c++ templates and classes but keep most other parts of the code identical.
As for c++ for me I just like having a labguge I fully grasp. This is 1 kf the main reasons I kinda like python it's small enough u can figure it out in a year.
So any python code I read I already seen that thing before and ik where all of the quirks r and what they can be. I think I would never get that with c++
2
u/alkatori Jan 20 '24
I saw the discussion, I just don't think it will happen. There has been strong push back in the past. I can also see the kernel team deciding that supporting Rust is enough and not wanting to add another language.
My recollection is they use a lot of C++ keywords as variables, so it would be a big endeavour to get it compiling with a C++ compiler.
I've been wrong before. So we will see.
-2
u/the_Hueman Jan 20 '24
I think newer languages like zig will replace it. Zig gives the same level of control with modern safety features.
C is the first language I've learnt and I'll continue to use it. It shouldn't be forgotten.
10
u/princepii Jan 20 '24 edited Jan 21 '24
c is the backbone of mostly every embedded system, of drivers helping software to communicate with hardware ect.
it always will be a part of the chain within the iot!
future always proofed us that one day everything will change but for the next 20 years i don't think that will happen to c and i don't say that because em working with it.
c is beautiful...it really is!
1
Jan 20 '24
i do really like c I really wish i wont be forced into c++ but it seems to be out of my control... ml is just made in c++ and python.
good thing about c++ is u can allways say "fuck it i write this in c anyway" on small projects that u r the only contributer
2
u/princepii Jan 20 '24 edited Jan 21 '24
when this is your decision coming deeply from your inside, i really recommend you doing what you think you will be comfortable with the most.
i don't say c is better than c++ or vv. this is absolutely not my intention here. i started with c long years ago and after i were ok with the fundamentals of c, i understand that i never will be able to ace this language. and this is what it is about for me. 14 years later i alway come up with something new with the characteristics of c. so i never got bored or something.
btw from c to c++ was really not a big deal for me. i think i got the syntax within 2 weeks and was comfortable with it like in a year. but i never touched anything other than c when i started. c++ came 4 to 5 years later in my mind cuz i really wanted to know c good enough before seeing something else. em also familiar with python since 2 years.
i just wanted to tell someone my experience:)
1
Jan 20 '24
Was a really helpful thing actauly my main fear with c++ is the absolute ass features u need to know.
Like i recently had a thing I did with a colleague were we pair programed python and they were really impressed with how I knew the languge so deeply that I could catch all the wild stuff. To do that with c++ would take a lifetime. I am just not sure I am willing to commit that heavily Into it
5
Jan 20 '24
C will always be the choice for compliers and embedded systems because it can do the low level stuff and the results are fast and compact. Also legacy OS stuff.
Go is used in server applications.
Rust is designed to replace C in operating systems, the Linux kernel has started down that path and it's accelerating. And unlike C++ Linus isn't opposed to it. Getting rid of memory errors, pointer errors, null terminated string errors
Python has replaced C as a general programming language and it commonly used for introduction to programming online and at university. But for important protects the key functions in python code, and Python itself, are going to be written in C to improve performance.
So C will always be around, but it will in a few specialist areas and as part of C/C++/C#/Objective C rather than just specialist C programming.
1
Jan 20 '24
idk embedded systems I see moving to C++. at least thats people ik personaly. there is also the argument for zig because its lighter but I am not smart enough
still c seems like a good choice there
with python packages they are also moving to C++ at least in the ml world. both tensorflow and pytorch r made in c++ and expect extensions in c++.
3
Jan 20 '24
Crazy to say embedded is moving to c++. I worked an embedded job that used it, and it was pointless. You can use a small subset of the language, obviously the STL ends up being avoided at all costs in the embedded world
C++ gives you classes to organize code in the embedded world…. Something pretty much useless
1
Jan 20 '24
Why is STL so bad? Is it the long names it gives? Don't u just end up mangling it in production anyway?
1
Jan 20 '24
The STL is going to use memory on the heap, you tend to avoid that in embedded
1
Jan 20 '24
cant u just overwrite the new operator globaly so it stack alocates?
1
u/No_Statistician_9040 Jan 21 '24
In embedded the purpose of your program is very finite, and you should be able to deduce what runtime memory is required from the context of your program and allow you to just have them exist in global scope. Alternatively, if you really really need some runtime allocation, you could write a allocator to partition a chunk of stack memory like you propose, but unless you have some really specific reason to do so, you are just wasting valuable resources and execution time on something you could have planned out beforehand.
1
2
Jan 20 '24
There is just no way to know how big some objects are gonna grow. You could use a subset of the STL, but he’ll I think rust is now a better solution for something like that. If I recall correctly it has a subset of the std lib that doesn’t touch the heap
1
Jan 20 '24
I'd forgotten about Zig, I looked at it a year ago after I read an article on it. I can see that it is very flexible and powerful, and would be great as a specialist language for embedded system and kernel programming. But the syntax is ugly and extremely complex and I can't ever see it being more than a niche language.
2
u/joejawor Jan 20 '24
This comes up every decade or so. I assure you C is not going away any time soon.
1
Jan 20 '24
I am pretty sure the next 20 years are safe but I am fairly young I wana be using a labguge for 30 years
1
u/ZackArtz Jan 21 '24
i wouldn't think of languages this way, at the end of the day they are all just tools. i wouldn't worry about c being dead or alive within the next 20-30 years, the concepts and principles you'll learn with C are the core of most to all of the languages that could dream of replacing it. and limiting yourself to just c or cpp for 2 decades would be shocking to me, im sure that in that span of time you will expand your knowledge into other languages and domains, as you various projects and jobs may have different requirements (therefore needing different tools) as you journey along your pathway. as others have said, learn c first to get the essentials, and then go wherever feels right for you and your project!
1
Jan 22 '24
ya i am starting to see a lot of the people who know c also know c++.
which is honestly kind of inspiring because it takes a LOT to be good with both.
2
u/wsppan Jan 22 '24
1
Jan 22 '24
Great article.
God so many stupid decisions by ppl. Like why do u need to define intmax_t if it'd just 64? Like grrr just say what u mean and be done with it.
But still speaks volumes on how important c is because somehow this huge mess is still handled by everyone and it kinda just works... which is a miracle
2
u/wsppan Jan 22 '24 edited Jan 22 '24
Before C, all OS code was made specific to the hardware via it's own assembly language. Thompson and Richie created Unix as a cross-platform OS and needed a cross-platform language to dog food. So they invented C to rewrite the kernel and BIOS libraries and later the standard library. The language they wrote needed to be this perfect level of abstraction. From that point on, if you wanted to create a higher level language and later on applications written in that language, you need to communicate with the underlying OS. Which is written in C.
Until all major OSs get written/re-written in another language and all get deprecated and tossed on the dustbin of historical relics, C is your protocol to the OS. Not to mention every single programming language used today is written in C and the billions of LOC written in those languages as well as the billions of LOC of C itself used in the billions of microcontrollers that power nearly every smart device and automotive chips, etc.. .
C is nowhere close to "dying," if ever.
1
Jan 22 '24
Its a legacy code situation no? Like unrelated to the original question but Like my logic is as long as a kanguge dosent see new code and projects it's gona get slowly replaced.
Take firtran vs cobol for instance. Fortran sees new hpc stuff with cuda fortran and omp. Cobol dosent really see much new.
2
u/wsppan Jan 22 '24
But none of these legacy languages are protocols to underlying OSs. None of those languages are the ones other languages create FFIs for.
"Everyone had to learn to speak C to talk to the major operating systems, and then when it came time to talk totime. other we suddenly all already spoke C so… why not talk to each other in terms of C too?
Oops! Now C is the lingua franca of programming.
Oops! Now C isn’t just a programming language, it’s a protocol."
C will not be a "legacy code situation" until C is replaced as the protocol for all the languages out there. That won't happen until you can talk to the OS without C. That won't happen until all major OSs that are written in C are rewritten. That won't happen in my life time.
1
Jan 22 '24
Ya I see what u mean here. Its super key for a lot of general stuff.
Also even tho ppl like talking about how it is inconsistent its actually fairly robust like most the time cross compiling c just works regardless of version.
Sure there r outliers but if ur external functions use c99 standard typed it all just works and it's really really nice.
I constantly see 2 types of ways to think about it: 1 as a general protocol and scripting langue. Ie u wana talk to the os or other programs use c because u have a c compiler and they are compatible with it. 2: as 1 of the fastest options around for hpc.
Ig it will always be a protocol like even if Linux is implemented in rust u would want c bindings for the rust programs... since its not like rust or c++ r compatible over time. Unlike c
1
u/wsppan Jan 22 '24
Also, there are billions of LOC of COBOL in production across the entire federal government and the banking industry running on mainframe computers supplied by billion dollar corporations like IBM and Unisys with hundreds of million dollars in contracts to maintain these systems. Rewriting these incredibly complex and mission critical systems will not be done in my lifetime. Nothing new is getting written in COBOL but is is very far from dying.
1
Jan 22 '24
Yes ur right. But for me I am working on mote cutting edge stuff and I like doing it.
Like I wana make new NLP models and infrence runtimes. I did it in python u till now which I would probably still do but having something like c or c++ is REALLY nice when u r building stuff that needs so much compute.
And I dont think the NLP part is what makes cobol not a vaiblr choice for me. Anything new I would eana make cobol is not a good option it's only good for maintaining cobol
7
Jan 20 '24 edited Jan 20 '24
I developed a full featured winsock2 client/server file sharing app in pure C using the winapi - full GUI. DLLs and all, it runs incredibly well on XP - Windows 11. This is intended to serve about 95K users on a BT network, so the transition is incredibly easy.
Is C dying? Heck no. The choice is up to you. I don’t follow any trends at all, I lean on the performance and low memory benefits, period. I left .NET after 3 years and I couldn’t be happier. My compiler community welcomed me with open arms and met some great people on that forum.
It’s a matter of what you wish to do. Remember, Windows is C and Assembly under the hood. C++ calls the same API calls and inherits no difference between C and C++ in that regard. MFC is just a big wrapper for the WinAPI functions, as well as much if the .NET CLR.
Basically, at the root of things it is C.
I just speak for Windows. I don’t use Linux.
I have zero knowledge of Python or GPU ML. I just speak for the language itself, for this platform. It should apply to Linux as well in regard to the “die out phase” of concern.
If I had a dollar for every time I was advised to use Rust or .NET, I would be a rich man. The project is now mature and performs fantastic! Why use those recommended languages? I just don’t understand the need to, when C provides everything I personally need without the overhead.
1
u/Ok_Donut_9887 Jan 20 '24
every hardware and software are built on top of C. Python is written in C, Rust is written in C…
1
Jan 20 '24
rust compiler was written in ocamal and then moved to rust.
1
u/pedersenk Jan 20 '24
Yep, but keep digging deeper. For example, why does Ocamal need GCC (a C compiler) for install?
Likewise for Rust. It is based on LLVM. There is a *lot* of C in this. Arguably there is more C and C++ in Rust than there is actual Rust.
C is the entire computing platform at this point. For better or for worse, we cannot move away from it.
1
Jan 20 '24
Rn rust is compiled in rust with llvm... so ya c is in the stack but like... it'd a c++ project.
Basicly a lot of stuff which are really interesting are c++ projects that use old c stuff
1
u/pedersenk Jan 20 '24 edited Jan 20 '24
Yes, and no (kinda) if we look at C not as a language but as a "facilitator of tech".
LLVM is a primarily C++ project but still contains over 20% C (obviously C++ has a unique strength that C can almost 100% be consumed by it).
libc++ (and libstdc++) also require libc. So in many ways C++ can't exist without C (for better or for worse).
So I am not really talking about language at this point. Purely from a lifespan point of view; C will always have a longer lifespan than things built on top of it.
(If you go even deeper; many assemblers are also written in C these days, so it kind of starts looping around at this point. If C suddenly died, does i.e x86 assembly also die? Practically it kinda would for a while on a number of platforms because we wouldn't be able to compile it). Dependencies are complex and non-intuitive.
1
u/TribladeSlice Jan 20 '24
I’m not sure I’d stretch the definition of “written in” to include transient language dependencies if thats what you’re trying to do TBH.
1
u/pedersenk Jan 20 '24
Me neither.
It is more the fact that C *must* have a longer lifespan than the stack above it.
Don't think of C as a language at this point. Think of it as an abstraction layer above the physical hardware. It needs to exist for all the cool tech on top to work.
1
1
u/zhivago Jan 20 '24
Language isn't very important.
The skills are mostly transferrable.
So learn whatever you want. :)
1
Jan 20 '24
idk for me it is because i need gpu programing so there r like 3 options c c++ fortran thats basicly it for languges that dont do api for gpu programing. if i wanted an api i would use python which i do...
1
u/zhivago Jan 20 '24
GPU programming is pretty simple, so just give one a try.
Might be fun to have an excuse to do fortran. :)
1
Jan 20 '24
I do wana do some fortran just because it's such an interesting languge. Like how is it not dead????!!!! And now they do oop????!!!!! Like just a wild story.
But I got enough on my plate already its gona be on my to do list of langs
1
u/Jak_from_Venice Jan 20 '24
I see two flaws on your thinking:
it’s wise to know more than one programming language
you’re measuring the value of your knowledge on profit
Programming languages are tools and the more you know the better. Really few hackers are using Lisp, but still Lisp is influentatial once you learned it and you try to apply its principles on every program you have to write.
C has an incredible successful story. But you do not do web development in C as you do not do system programming in Ruby.
Try languages. Try often. That’s the knowledge that will reward you
1
Jan 20 '24
It's not profit isc for money it's usefulness. Basicly how good of a tool is this languge to do the things I wana do?
For instance rust is cool I may learn it for fun but FOR ME it's not useful because it's an hpc languge that can't run on gpu. So if all I do is api calls I may as well use pytorch... (for instance rust burn is a pytorch backend so like... just use pytorch the cpu overhead is meaningless).
C for me is a tool for running gpu code and I still need to learn c for cuda that's not going anywhere but on the cpu side everything uses c++ to setup those kernals and the support for pure c is not there.
I am basicly revaluating is pure c worth learning and while ya I need it for the kernals I think the rest of my code would need to be c++ and I need to accept that.
1
u/Shad_Amethyst Jan 20 '24
You might find more luck with rust or zig, if your plan is to build fast but complex things.
C's (and C++'s) main strength is in its ability to work anywhere, since C is such a simple language to support (and C++ an obvious extension to build towards, despite its complexity). But if you're going to be doing machine learning, then you will pretty much always:
have a GPU or some acceleration unit
have an MMU
have an underlying operating system
In this kind of environment, any performant language can be used for your needs. You can then tie whichever languages you choose together using the C ABI, like you were initially planning to by using Python and C.
The knowledge you have gathered so far from using C won't be wasted, since you mentionned in a comment that you're interested in HPC. C++, Zig and Rust all build upon those concepts. OpenCL is based on C and CUDA is based on C++. C is still the most common ABI for language interoperability.
1
Jan 20 '24
Cuda is pretty much pure c it has its own dialect cuda c and kernals are build with that and that alone.
With c++ u can sometimes get around that issue if u use openmp but stuff like pytorch gives u a device pointer which is more natural to use cuda with (even tho openmp is cross platform).
The answer is probably c abi with c++ classes to make it pretty which is how cuda is build and so that's the general philosophy of ml by extension
1
u/integerdivision Jan 20 '24
COBOL and Fortran are still going strong. C is going to be fine for at least 30 thirty years. Also check out Zig.
1
Jan 20 '24
If zig had openmp and cuda I would learn zig. It looks so interesting I am tempted to learn it anyway.
Ik fortran is still used in hpc for new projects but I am pretty sure cobol is dead. Its just legacy code no 1 starts a new cobol project because they want to use cobol
1
u/integerdivision Jan 20 '24
Pretty sure there are more people programming COBOL now than fifty years ago.
And Zig is a new language that interops with C. Learn C now — but there is a future with Zig as well — you can have Zig code next to C code.
1
Jan 20 '24
Can u point to any new cobol projects that are exciting something g from the mast 10 years?
1
u/integerdivision Jan 20 '24
The CHAD stack lol https://github.com/ThePrimeagen/CHADstack
1
Jan 20 '24
Lmao 🤣 🤣 🤣 Isn't the Chad stuck a joke about the least useful stack
1
u/integerdivision Jan 20 '24
Yeah. But for real, COBOL is not going anywhere: https://www.techrepublic.com/article/cobol-remains-alive-and-well-despite-its-age/
1
Jan 20 '24
This is an article talking about how good the legacy code is. I don't doubt it for a second.
But that's the last part of the lifestyle before u just die
1
u/integerdivision Jan 20 '24
$4–8T says that code is going to run practically forever.
1
Jan 20 '24
Idk company's die out every 100 years or so... like how long would the organisations running it last? How long would the hardware last? Is no 1 gona come up with a better way to do things on the speed?
Idk I think cobol may have new stuff to offer but haven't seen it in my domain.
→ More replies (0)1
u/integerdivision Jan 20 '24
Top put it in another perspective — it’s pretty rare that mainframes get retired, and the current market size for new mainframes is about $5B. Tiny compared to the PC market. But these machines will run for decades.
1
u/Ok_Tangelo_3232 Jan 20 '24
I learned C in 1979. By that time it wasn't a new language.
Since then, many languages/technologies/stacks have appeared & disappeared. It has continued.
At one time it was the only game in town for many things. Now it's the most popular game in town for fewer things.
C is, fundamentally, a different language that excels at different things than C++. This has been muddied for three reasons:
The fact that C++ can be used as "super C" if you like. People did this more before C became "super C" itself.
The fact that before C++ people used C for things that C++ is superior for. That caused some reshuffling .
The fact that people insist on saying C/C++, which is misleading & unhelpful.
For someone who used to program in C most of the time, the most recent time I used it was Arduino development, for which it was super awesome.
What do you actually want? What do you want to do with programming? Are you looking for a general purpose programming language to do everything in? My personal advice is, don't do that, embrace the many programming languages that exist & use the correct one for the task. For someone starting out, it seems like changing languages is a traumatic event, but they are (usually) much easier after the first one, & you can know many. It's not a "change" it's an addition, & the additions are not so difficult.
If you love C, there will be plenty of C applications for quite a while, I expect. However, almost certainly, you will be coding in a different language, probably several, by the time you are my age. Don't worry about that.
C is awesome for the things it's awesome at. It's bad at some things. It's not vanishing.
My recommendation is that you use it & enjoy it, but, stop being a C programmer & start being a programmer who knows C.
1
Jan 20 '24
Well I mainly use python I m looking to get into c for writing kernals and general hpc code. I suppose I should go with the vibe of just learn everything u will.probably use it.
I think I like the idea of c until I make too many dumb macros then c++ something about that is very charming.
2
u/Ok_Tangelo_3232 Jan 20 '24
That's totally charming!
I commend you for "just learn everything". That has been what I've been doing for 40 years & it's been 10/10, no notes. You may be surprised by:
How often things that you learned turn out to be directly useful.
How much, having learned stuff helps in an inchoate, non-specific way, where you are not directly using the specific knowledge, but somehow it makes your brain be ready to think things through.
Enjoy the journey!
1
u/mecsw500 Jan 21 '24
Same for me, 1978, on PDP11s running UNIX V6 and V7. ANSI C offered some decent improvements if used sensibly later on.
If written carefully C is a secure as any other language. That’s true of assembler as well. Writing code carefully with forethought and decent testing is the key. Many C projects have 10s of millions of lines of code and run without issues all over the world. Many IBM mainframe and other critical code products were written in assembler even.
Later languages such as C++, Rust and Zig may improve code quality in some ways but also in the case of C++ it sometimes reduces it in the inherent complexity of the language and the cleverness of people determined to exploit every feature it offers in their code.
In fact, adding classes just to bind the locality of variables with functions to the C language might be a reasonable extension as long as one steered cleared clear of inheritance and so forth. Classes don’t seem to be the concept that makes C++ some complex, but the inherent desired to use them in terms of objects.
I think, if I remember correctly, Simula67 introduced the idea of classes, so it’s an idea that’s been around long before ANSI C and C++.
One of the things that matters to many in their choice of language is the ability to use make type CLI software generation tools as well as an IDE, along with debuggers that work in both user and kernel space. For some projects, the ability to insert inline assembler is desirable too.
1
Jan 24 '24
Linus is certainly keeping an open mind these days - https://www.youtube.com/watch?v=VHHT6W-N0ak&t=61s
Still, there are some 27 millions lines of code in the Linux kernel and millions of lines in Windows, Mac OS-X and Android, not to mention embedded C in devices. I think that someone will always need to be able to understand, maintain and modify all that legacy C code.
1
Jan 24 '24
Ya thinking about it a while even if the kernal is c++ uts gona talk through c. C++ changes every few years it's not the best thing for an os. Meanwhile c only really changes drastically every 20 years so that makes for better system code on the interaction layer.
There is also gpus and I somehow suspect thst when quantum computers become a thing it would be a c api first.
1
Jan 24 '24 edited Jan 24 '24
Your mention of quantum computers is interesting and got me wondering. Researched it a bit - they mainly use specialized languages like Qiskit and Q#, designed for quantum systems. Efforts exist for computing libraries in C and C++ but these Q- languages will likely remain the primary tools for quantum development.
1
Jan 24 '24
I am thinking that we are still on assembly level there in a lot of ways because u cant really burn too much of it.
it could be that this time around ppl would make it its own languge or a python package directly.
1
Jan 20 '24
C is the second most popular programming language in the world according to TIOBE.
1
Jan 20 '24
in terms of legacy code 100% wont argue its got at least a good 20 years in it just maintaining operating systems sql databases python extensions. compilers to c++ etc, like its not going anywhere.
in terms of new code... a bit harder to make that argument
2
2
Jan 20 '24
C is not going away any time soon, especially when it comes to low-level programming. Things like assemblers, compilers, operating system kernels, etc are still mostly written in C.
2
u/joebick2953 Jan 20 '24
Oyster first learned about the sheep programming the 1970s and they've been talking about always going to be replaced real soon
What soon is within a million years that'd be my bet
1
u/Exotic_Brick9543 Jul 24 '25
These comments are so bias lol. C language is considered a legacy language. It is definitely outdated but do not be quick to equate that with it no longer being in use because it still is as it is still relevant in legacy systems that are not able to convert to newer systems. But yes, eventually as new systems and newer languages steal the limelight in an exponentially evolving technical environment, it will naturally fade away. That may be decades from now but it is for sure not considered “popular” by any means. Even the newer computer textbooks consider and acknowledge C language to be a legacy language. You’re better off picking up a newer language alongside of C to be safe and to also widen your career opportunity.
1
1
Jan 20 '24
Getting more and more niche? Probably.
Dying? Lol, no.
Basically every digital device today has code written in C. A lot of them run Linux, some run a BSD variant, both of which have kernel which is developed primarily in C. And so are the next closest rivals, I believe.
1
u/Careless-Toe2464 Jan 20 '24
C Programming never dies. In fact, it's the basics for all other programming languages to start with.
1
u/Low_Employ_7867 Jan 20 '24
I think that c is never died. Because c is very large language and mother other programming languages
1
1
u/againstmethod Jan 22 '24
I don't think having a "main language" is a viable thing anymore. At least not professionally.
1
u/Select-Sale2279 Jan 23 '24
Anybody that says or thinks that C is going to go away is smoking cheap weed. Sure, the landscape has shifted to scripting and the like for a general purpose app development environment. But C still has its share in drivers, firmware, gaming and operating systems. C was never a language that did major graphical UI stuff and its lost a little share to the scripters, but I would learn C as a first language anytime and build on it from there.
0
u/joebick2953 Jan 20 '24
I also are check and see what my phone thinks I'm saying instead of what I'm actually saying C programming not sheep And I don't remember the other things they misunderstood
0
Jan 20 '24
[deleted]
1
Jan 20 '24
ha so u basicly say c++ and c should be looked at in unison.
i mean c being stable does make life easier. make sense if u want to make something that lasts and then let ppl use it from c++.rust I can see making sense as a server side for the web specifcly for safety. like rust would warn u about a lot of stuff at compile time that c or c++ wont so it makes it harder to hack. (this is at least what most security experts say and a lot of them have to be proficient in c sense its everywhere).
I think i see ur thinking and this ABI aproch is actualy how I started writing c++ I think i really like it so i would probably start with c and then do c++ like that where c is the core of the program and c++ is just pretty on top
0
3
Jan 20 '24
[removed] — view removed comment
1
Jan 20 '24
can u list exmples? i have been having trouble finding any since legacy stuff pops up instead. i did find some but usually extensions to existing c code
1
Jan 20 '24 edited Jan 20 '24
[removed] — view removed comment
1
Jan 20 '24
Oop in c++ is useful when u want to make a package for others to use. This is fairly similar to how it's usually used in python.
When u want to define something like an ml layer that takes in data does an operation and spits out data and it has weights and gradients etc. It makes a lot of sense to put it in a class.
But ya u kinda hate oop as a general rule I think procedural code with as much pure functions as u can is the best way to go.
But c++ isn't really about oop it's about having all these weird ass features. Like new c++ has oamda functions and shit that's very diffrent from c+oop
26
u/hate_rebbit Jan 20 '24
I don't think the linux kernel will be moved to c++ as long as Torvalds is alive, unless someone knows something I don't. Small parts are in Rust now, but it's still mostly C as far as I know.
C still has uses: I don't think it's going away in embedded, since it's a small language that's easy to write a compiler for. If you're shitting out new chip architectures, might as well pair it with a C compiler. For GPU code, someone with GPU experience will have to tell us.
The distinction does matter -- they're different languages with different feels -- although I write in both languages and I would expect a lot of other C programmers do too. My C++ looks very C-ish, but I work on very object oriented code bases and it's a little out of place.
You could learn C first, then C++ after that.