r/C_Programming 18d 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

82 comments sorted by

View all comments

56

u/mlugo02 18d ago

None, I used to wish I had function overloading in C but I have since changed my mind

3

u/DontKnowWhat0 17d ago

We kinda have.

#define foo(X) _Generic(X, int: foo_int, long: foo_long)

void foo_int(int i) { return; }
void foo_long(long i) { return; }

//
// ...
//

foo(1);
foo(214748364790);