LWN.net Logo

Object-oriented design patterns in the kernel, part 1

Object-oriented design patterns in the kernel, part 1

Posted Jun 2, 2011 13:19 UTC (Thu) by Cyberax (✭ supporter ✭, #52523)
In reply to: Object-oriented design patterns in the kernel, part 1 by juliank
Parent article: Object-oriented design patterns in the kernel, part 1

And you can do this in C++ just as well. What's the problem? Quite a lot of C++ libraries have pure-C interface (often for the reasons of compatibility with another languages).

Then there is COM. There are COM-interfaces in Windows which are stable since _1993_ (the ones that deal with OLE) and that's kinda hard to beat. And COM maps directly into C++, COM-interfaces are just pure C++ classes. AddRef/Release can be managed using smart pointers and QueryInterface is dynamic_cast<> reimplemented manually.

Yes, designing stable C++ interfaces requires some forethought. But pure C interfaces require no less forethought.


(Log in to post comments)

Object-oriented design patterns in the kernel, part 1

Posted Jun 2, 2011 20:14 UTC (Thu) by pr1268 (subscriber, #24648) [Link]

I had asked that my earlier post not be construed as an attempt to start a language war, and, guess what? We now have a language war.

Sigh.

At least this one has been fairly tame. If there's anything nice about the above discussion, it's that I've learned a lot about exception-handling programming. Thanks! ;-)

Object-oriented design patterns in the kernel, part 1

Posted Jun 2, 2011 22:24 UTC (Thu) by Cyberax (✭ supporter ✭, #52523) [Link]

Well, I actually deeply hate C++ :) But I also can't tolerate FUD for the languages I really hate.

Object-oriented design patterns in the kernel, part 1

Posted Jun 3, 2011 8:10 UTC (Fri) by marcH (subscriber, #57642) [Link]

Agreed, such FUD and lies are really annoying. I have very little love for C++ but anyone who claims that C++ cannot do something while C can is just making pure noise and calling to be filtered out.

Object-oriented design patterns in the kernel, part 1

Posted Jun 9, 2011 16:29 UTC (Thu) by jd (guest, #26381) [Link]

If we're going to have a language flame-war anyway, I propose rewriting the kernel in Occam. :)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds