Why not using C++

Jacques Guillou jacques.guillou at gmail.com
Fri Oct 8 03:07:58 PDT 2010


I am working on a project which has some similarities with DBUS, since it's
an IPC framework involving a daemon process which dispatches messages to
clients connected to it over a UNIX domain socket.
It's currently completely written in C. Since the daemon has to support some
pluggable components, I use some C structures which mainly contain function
pointers pointing the my plugins specific function.
These structures can be seen as a virtual function tables as they are know
in the C++.
Since implementing this in C is actually quite painful and error prone, I
wondered whether it would make sense to implement this in C++ instead of C,

According to me, there are already a lot of benefits of using the C++
language itself over C :
- Helps making the design of your application cleaner, when using object
oriented concepts
- Provides stricter type checking
- Allows using templates

Now the drawbacks (?):
- Need a C++ compiler (nowadays, there's one on every platform we support,
right ?)
- Need to link against libstdc++ library (this can be avoided, as it is
described in this thread :

So now my question : Would it make sense (or would it have made sense) to
implement DBUS in C++, without using any of the C++ libraries (STL,
libstdc++, etc...), since the language itself provides some benefits over C,
without any drawback (apart from the fact that some people don't know C++) ?

What do you think?

Best regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20101008/21978565/attachment.htm>

More information about the dbus mailing list