r/C_Programming • • 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.

51 Upvotes

114 comments sorted by

View all comments

Show parent comment

2

u/septum-funk Oct 20 '26

tagged unions are indeed the goat of C and the only reason i use C11 is for anonymous unions. it's genuinely the only feature i use from it, so you can have the type tag and value on the same level

1

u/LordRybec Oct 20 '26

I'm fine with the extra nesting. It's marginally more typing, which doesn't matter anyway. I will admit that I've occasionally forgotten to nest to the right level when accessing, but that's trivial to fix.

That said, maybe I should look into other features of C11. My primary reason for sticking with C99 is that I wouldn't use most of the features in more recent C standards, so why bother? Additional features often add additional overhead, so it takes more than one or two golden ones to convince me. That said, I haven't looked into C11 much. I don't want to use later versions that I have looked into. (C23's "auto" is pretty much pointless, as most types it chooses are easier and shorter to type than "auto" is! And if I'm using C, I'd rather have the explicit typing. If I want implicit typing, I'll use Python.)

But yeah, that is kind of a compelling feature. Unfortunately I do a lot with microcontrollers, and a handful have compilers that don't go past C99 (or in one case, C89), so learning nice but not critical features would just make it harder to program in earlier C.

1

u/septum-funk Oct 20 '26

fwiw i'm pretty sure they're a gnu extension in c99 as well which is nearly portable

3

u/LordRybec Oct 20 '26

I use GCC pretty much everywhere, because it's more portable than any other C. No C complier is 100% compliant, but GCC is close and is at least consistent across platforms and exists for nearly all platforms. So yeah, probably the most portable C.

I'll have to look into that. If it is indeed part of GCC C99, it would be worth my time to use it. I do use other compilers for certain very weak microcontrollers, but they are so far from even being C89 compliant that it makes no difference. (Standard C isn't designed for Harvard architectures, so C compilers for Harvard microcontrollers have to include a ton of extra stuff to do things like specifying which address space each variable is in.) Pretty much everything else I program for uses GCC. It doesn't have C11 support for all of them yet (obscure ones specifically), but if it's in GCC C99, that's not a problem!

Anyhow, thanks! I'll look into that. It's nothing huge, but it would certainly be nice!

1

u/septum-funk Oct 20 '26

The only microcontrollers i use myself are popular dev boards which already support C11 and i'm sure higher (pico, esp32) so i suppose i'm quite lucky 🤣 good luck!

2

u/LordRybec Oct 20 '26

I enjoy learning unusual systems, so I suppose I do it to myself. (That said, my current favorite is the RP2350, which is what is on the Pico 2. The ESP32 is also pretty good, but I haven't done much with it yet. I also like the CH552 though, which is an enhanced 8051 clone, and which uses that Harvard architecture. There's no GCC for that currently, and there may never be, due to the additional complexities of the Harvard architecture.)

So yeah, I looked it up, and anonymous unions originated in GCC's C99 extensions, and then were included in C11 later. I was not aware of that. Here I've been doing it the hard way for so long.

It's ironic, because I'm very aware of a lot of other more esoteric GCC extensions, like function attributes, which I use regularly, but somehow I missed this one.

Anyhow, that will make things easier! Thanks again.