Re: [linux-audio-dev] (OT) C++ flame war

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] (OT) C++ flame war
From: Martijn Sipkema (msipkema@sipkema-digital.com)
Date: Thu Feb 06 2003 - 04:22:22 EET


> > You are not forced to define the private data members and functions at
the
> > same time as the public ones in C++. The way to handle this is to put
the public
> > interface in a pure virtual class:
>
> In my opinion (please note that this IS an opinion) the method you propose
> is at least as ugly as any other way of keeping a class's private data
members
> private. IMO, using C and doing

I don't see what makes the method I propose, and that most C++ programmers
use, ugly. It is much cleaner and explicit that your method below.

> typedef void Object ;
>
> Object * Object_new (/* parameters */) ;

You cannot create an Object on the stack. With C++ classes you can. This
makes resource management much easier.

> int method_1 (Object *object, /* parameters */) ;

This is not type safe. I suppose this function method_1 then calls another
function
via a pointer stored somewhere in *object?

> void Object_delete (void) ;

void Object_delete(Objects *object); ?

> and then using a struct (return a pointer to it from Object_new()) in the
> implementation file is neater and works better.

I think it is less flexible, less readable and error prone.

> If you think C++ is great, then you are entitled to your opinion. In my
> experience, the C++ boosters are far pushier with their form of religion
> than the people who prefer C to C++.

Hmm. I tend to think it's the other way round. (the standard "C++ is slow",
"C++ isn't really OO", etc. arguments are quite often seen.)

> > I think most of the arguments in the article are not valid,
>
> Most of the arguments or just the ones relating to C++? I did talk about
> stuff other than C++ in that article.

I meant only the ones related to C++.

[...]
> 2) OO can be done in Standard C.

Sure. But the language does not support it, it merely enables its use.

> 3) Some people (me included) might prefer doing OO programing in C
> rather than C++.

It is not up to me to tell you what language to use. As you in your article
talked
how you think C is a better language, I gave my point of view.

--ms


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Thu Feb 06 2003 - 04:22:38 EET