← Back to context

Comment by card_zero

18 days ago

C++ reimplements a lot of the things we do in C with function pointers, while hiding what's actually happening behind topheavy syntax that implies a 1990s object oriented paradigm that's dead now.

Contrary to popular belief C++ isn't really object–oriented. I mean, you can write object–oriented code, but the language doesn't make assumptions about what goes into a class. It's really just a struct with associated functions.

  • > It's really just a struct with associated functions.

    If that were actually true C++ would be a lot easier to accept as a 'C successor'. Instead you have the implicit this-pointer, complicated rules for which constructor or operator overload is actually called, a hidden vtable pointer (not to mention multiple inheritance), then you have public/private/protected, override vs final, const methods (which wouldn't be needed as a separate syntax feature if the this arg wouldn't be implicit) etc etc etc... that a lot of OOP-baggage which a lot of C++ coders probably don't even notice anymore.

    A plain C struct with function pointers does indeed make a lot more sense than all the OOP-ism that C++ hides from you ;)

    • It has lots of optional features, none of which make it an object–oriented language. It's an everything–oriented language. It has lambda syntax for functors, but you're not calling it an impure–functional programming language. Virtual functions are one feature, which is useful in pseudo–object–oriented code.

  • That's an odd opinion about a language with a lot of class related features. I can only assume you have a very strong definition of OOP.

how is OOP dead if tons of code keep being written using OOP these days? From anything corporate in Java/C# to Hyprland C++

What modern GUI in mainstream OSes isn't using OOP?

Have you bothered to look how GCC and clang are implemented?