r/C_Programming • u/Ok_Reserve996 • Oct 18 '26
C limitations
Hi all,
I am currently learning c++. Its okay. Not sexy but also not as bad as some say.
The reason I am learning c++ is that I have read that C has limitations as soon as a project gets more complicated. For example, if you make a scientific calculator with many features like graphs etc.
Trading engines/tools are also not recommended to programm in C.
Since I have not learned C and have only read from some old forum posts etc, I cannot confirm/deny these facts.
I am aware that "everything" is possible and that C++ comes with QoL improvements especially with Classes. But I assume that doesn't mean that someone has to use C only for kernel work. Embedded is also possible with C++ right?
I would appreciate your thoughts and opinions.
The goal of this post is to understand how and if C could fit me more with my goals and what real advantages or disadvantages C has.
View all comments
13
u/LordRybec Oct 19 '26
I don't find C++ easier to use than C. I find the supposed quality of life improvements to make the code harder to follow and especially more difficult to debug. When working with code written by someone else, I find that C code is generally written to a higher standard of quality and is easier to read than C++ code.
Now, this doesn't mean everyone has the same experience that I do. I know people who prefer C, some of who prefer C++, and some who don't like either. The reality is that "better" is somewhat subjective. I'd hate to do say, a scientific calculator in C++. Neither language is significantly better when it comes to string parsing. I see no benefits in using objects for such an application. I've actually written a graphing calculator in Python, and when I was much younger I wrote various types of graphing applications in QBasic for fun. The QBasic examples graphed specific functions and only took numerical inputs, but the Python one took full math expressions. Python has excellent text parsing capabilities built in. That part would be a lot more complex in C or C++. The supposed quality of life improvements in C++ wouldn't make any difference, aside from having to write a lot more code with very limited benefits if I wanted to use them. I don't know that I'd particularly want to do a graphing calculator in C, but I'd certainly prefer C over C++ for it.
Honestly, a lot of it is personal preference. C does have some distinct advantages, but they won't matter most of the time. Most of the features of C++ that people seem to like cost significant extra memory and processing time, and some can cost a lot of CPU time, causing the CPU to wait for cache/memory interactions. In general, C performs significantly better. But, unless you are writing code for embedded systems or ultra high performance applications, it won't matter. C++ objects maintain pointers to function tables, and those pointers cost extra memory. The typical object may use between 1% to 10% more memory than a similar struct due to the this. The way memory is organized within objects tends to cause cache memory to load entire objects even when only one or two member variables are being used, which increases cache misses, which costs a lot of CPU time waiting for memory to be loaded into cache. The use of function tables means that calling methods of objects costs at least two pointer lookups from memory, where calling a normal function that takes a struct would have the function call hard coded with no pointer lookups. Operator overloading makes function calls look like basic math operations, so you may not realize just looking at the code exactly how much it is actually doing. But again, if your program isn't already using a lot of memory and CPU time, these aren't going to make much difference. Modern CPUs are fast, modern systems have a lot of memory, and as long as you aren't being blatantly wasteful or completely careless, you program will work fine and won't even use enough resources to impact other processes on the same system. Maybe you find the C++ syntactic sugar additions to be more to your liking than I find to them to mine. If so, then maybe you'll like C++ better.
That said, if you are programming embedded systems, the increased costs of C++ can add up quite fast. You may not have to worry about the cache coherency issues (most embedded microcontrollers don't have cache in the first place), but having to do extra pointer lookups and maintaining function tables make a much bigger difference on a 8MHz to maybe 125MHz or so processor with anywhere from 500b to maybe 8MB of RAM. When working within resource constraints like that, the difference between C and C++ can be quite noticeable. It does still depend on what you are doing, but it's something you do need to consider. If nothing else, it can be the difference between managing the project on a 25¢ microcontroller and a microcontroller that costs a dollar or two. The price difference might not matter for a hobby project (though, what you happen to have lying around might matter), but for a professional project that you intend on selling copies of, it can be a huge difference. So sure, a lot of embedded stuff can be done in C++, but there are often good reasons not to even on systems where it can.
Anyhow, my personal preference is C, and I don't find the "quality of life" features of C++ (or even more recent C standards) to actually improve my quality of life, but your mileage may vary. If you want to learn C++, go ahead. It's unlikely to hurt. But go into with some introspection. C++ advocates will tell you that C++ features are a huge improvement. Don't blindly believe them. Pay attention to how they actually impact your workflow and judge them by the results you get out of them. In this field its easy to get sucked into the "newer is better" thing, but in my experience newer is often less stable, more experimental, and often different just for the sake of being different. There's a reason C is still being used even in new applications despite its advanced age. It's a very strong and powerful language, which has withstood the test of time extremely well. It's not perfect, but if it didn't have significant advantages, it wouldn't still be being used for new work almost constantly.