Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You're right - "re-inventing the wheel" is probably the wrong phrase - I used it because it conveys a sense of needless effort when there is a better alternative.

Basically, those who don't have access to basic object-orientation are doomed to implement it themselves in a messier, more verbose form.



I think the argument that Torvalds was making here is that that's exactly what C++ is. Messy and unnecessary. You can write C++, but if you do so without the mess, you're so close to C that there's no point in using C++.

I, on the other hand, would argue that C's lack of object-orientation somehow dooms one to implement it. OOP is _not_ the pinacle of software development. Further, I would argue that "structs full of function pointers" neither, necessarily, represents a desire for object-orientation nor is it messy.


When your source code is full of structs that look like this:

  struct obj
  {
     struct obj_functions*  functions;
     ...
  }

  struct obj_functions
  {
     void (*do_something_with_object)(struct object* obj,...);
     ...
  }
... I'd say it's hard to argue that you're not implementing C++ style OOP, and that it wouldn't be cleaner to use C++.

Now, if you're just going to stick to the basics of C++ (ie. avoid templates, operator overloading, etc...), then there's a fair argument as to whether it's worthwhile. Certainly it's not worth rewriting the Linux kernel at this point.

But, I don't think Linus's comment that "C++ is a horrible language" is fair.

(I'm sure most of that is just Linus being Linus).




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

Search: