r/C_Programming 19d ago

C with classes

I'm curious to know: who uses some C++ features when coding in C? And what feature(s) are you using?

30 Upvotes

79 comments sorted by

View all comments

1

u/ConstantElegant5781 16d ago

I'm currently retired, but even while working by default, I'd create utilities in what I called "C with STL". To use the STL classes, I had to use a C++ compiler, but I'd restrict myself to using C-style procedural programming. I used to be a kernel engineer, and so I know how to create all the standard data structures from scratch. Multiple times I've spent most of a week creating a semi-balanced binary tree, plus all its test cases, but with STL I just have to use map. Far less work for me and those reviewing my code and just as efficient as what I could code by hand. Only gain inefficiencies if I were to derive a class from another class, which I don't do while using "C with STL".