[linux-elitists] Nobody's favorite language? C++ and free software
Wed Mar 26 16:22:51 PST 2003
On Wed, 2003-03-26 at 15:13, Nick Moffitt wrote:
> begin Martin Pool quotation:
> > Inherited classes could be added to C without major damage; you can
> > already do it with macro trickery.
> I always did it with nested structs. The first element of a
> struct is an instance of the parent struct, so you can always cast the
> thing and treat it like the parent. You need to be careful with
> memory management, but throwing big structs around on the stack is bad
> news most of the time anyway.
> Add in function pointers and use self parameters and you've
> got most of the functionality that basic OOP provides.
> I'm not a big fan of the goofy parallel structures that glib
> uses to get classes vs structs.
This is exactly what scares me about C and why I prefer C++. It is not
that you can't do these things in C it is when people do these things in
C it starts getting messy and hard to understand and it is difficult to
bug and often times just a bit buggy. Plus everybody does it just a
I think that the biggest argument for C++ vs. C is that people try to do
things that are native to C++ in C and it leads to inelegance.
More information about the linux-elitists