Hacker News new | comments | show | ask | jobs | submit login

There are some reasonable things here, but:

"Lumping together function pointers that operate on the same data structure is essentially object-oriented programming" is unbelievably contentious regardless of which of the various definitions of OOP you follow.

I would strongly disagree that it's contentious. (Think that over...disagreement about contention. I raised my eyebrow too.)

Some of the more exotic features of what people call "OOP", like polymorphism, take a bit more care and feeding to pull off in straight C. They are most certainly possible, that being said.

Unwind "OOP" to "working with objects that contain data and methods together," and structs with function pointers fit the bill. I've had people stand in my face and practically shout that C++ is object-oriented and C isn't, and one refused to believe or admit that C++ basically compiles down to C in the end.

If you try to equate C and C++ by saying C++ can compile to C (not sure if that's what you're saying but it sort of looks like it), you might want to change your argument a bit. Haskell can also compile to C, but that doesn't make C strongly-typed, functional, or garbage collected.

At a high enough level of 'care and feeding' it's possible to pull off these things in assembly, or Fortran, or whatever, rendering the term completely meaningless.

C++ 'basically compiles down to C' for some constructs more than others (exceptions, RTTI, multiple inheritance goop) but if the C it compiles to is dark, arcane, unreadable crap, then this is no more illuminating than the truism that C++ basically compiles down to assembly language.

> C++ is object-oriented and C isn't

Neither is object-oriented, except C++ allows you to easily work with objects unlike C, where you have to reinvent them.

It is easy for me not to pick C if I need more abstraction than a struct with pointers to functions can provide.

"Neither is object-oriented"

And thus the discussion devolves into a pissing contest over whose programming language is the most object oriented...

Look, one can reasonable agree to disagree on the definition of 'object-oriented', but I don't see how you can seriously state that C++ is not object-oriented. According to the most broadly accepted superset of what constitutes 'object-oriented', C++ is object-oriented (or rather, can be used in such a way).

You're right, I meant that it's not strictly object-oriented, it supports multiple paradigms, with OOP being one of them. :)

Yes, that I agree with.

Yup, many "hip" folks believe they don't do OO just because they are using a language without classes, etc.

But what's the difference between foo->doshit() and doshit(&foo)? Those people still don't get stuff like data orientation, etc. but are shouting out loud how evil OO is and how they killed that dragon ;)

You're probably getting voted down for the tone, but I agree with your point. Case in point - GObject, from glib (foundation libs of Gnome, for those not familiar with it). I understand the historical reasons for that specific case, but is the macro magic really an improvement over using (a subset of) C++ ? I'm quite sure it's not.

GObject and glib in general aren't an improvement over anything, and both are largely shunned by the c-using community.

Applications are open for YC Winter 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact