[MPlayer-dev-eng] c++ version of mplayer.c

Gábor Lénárt lgb at lgb.hu
Thu Feb 10 13:34:44 CET 2005


On Thu, Feb 10, 2005 at 12:32:40PM +0100, Attila Kinali wrote:
> > There is nothing to say that object oriented stuffs can only be implemented
> > in C++ ... See GTK for example. 
> 
> You can even write OO code in asm. I remember that TASM had
> some macros to simplify OO style programming.

Sure, of course! OO is an approach and not a programming language
parameter, well, mainly.

> > It's not the question that C++ is wrong
> > tool for mplayer or not. It's the quiestion that C is the wrong tool and
> > C++ would be better? It it's true, then yes: it worth to change to C++.
> > But if not, what's the problem?
> 
> C isn't the wrong tool, but neither is C++.
> I just see that a few things could be simpler to maintain and
> change if we'd use a OO-enabled language (i don't think
> C++ deserves to be called an OO-language).
> But you are right, a conversion from C to C++ requires engergy
> and it's not clear wether it's worth or not.
> (Actualy i tend to say it's not, as we had huge problems
> with C++ code in the past, hence only one C++ file is left)

Maybe C++ would have some advantages from the view point of code
maintain in SOME areas but not for others ....

> > > > And C coders are elitist in that they think that every language other
> > > > than C sucks big time. So what else is new?
> > > 
> > > Full ACK.
> > 
> > No. Don't get the idea. I've only said that there're several EXISTING project
> > like MPlayer, or Linux kernel, or whatever which is ALREADY written in
> > C, the developers of course know C (otherwise thet wouldn't have developed
> > it ;-), there was not problem with being C, so then WHAT the advantage to
> > change to C++? This energy requires to make this change can be used to
> > solve problems which are REAL problems. Of course if we're talking about
> > a just-born project, it can be OK to think about that 'starting to code
> > in C++ or C or XYZ?'
> 
> Actualy, i had the idea to port MPlayer to pascal once and not
> as a joke as the perl and java ports (who does remember them ? ;)
> Just to see whether it can be done and whether it has advantages.
> But i never had the time.

Hmm. As the view point of the software itself it's completly irrelevant to
code in C++ or C, Pascal or whatever, if there is a compiler which sooner at
later emits executable code for a specific platform (or for a 'virtual' like
java bytecode virtual machine) then everything can be implement with either
of languages. The problem is at the human side: first of all, some language
is 'simplier' to use (or at least simplier to create software FAST, the
growing need of RAD implies such a solutions even if the produced code
quality is lower), of course some people can code in language X, others in
Y, some of them in both of them. However one major point is the quailty of
the COMPILER. In theory noone can say that C++ is worse than C or C++ is
better than C. You *can* say however that g++ can optimize code for
size/speed better than Visual C++ or a plain C compiler with the C code. So
the 'benefit' of using another language is probably not the advantage of the
language but the compiler!

I only want to say that choosing a language SHOULD NOT BE an in-theory-only
process! It SHOULD BE a real-world problem as well, eg what kind of
compilers are available for this language on the selected platforms and so
on. Of course there are in-theory-only points as well, like the code
maintainity, and of course the fact that developers should choose language
they can code for ;-)

I wanted to describe my opinion longer, because I often saw (and seeing here
as well) to "let's change to C++" movments, without ANY real points, and
without any real world AND theoretical analization before. But in fact
programming is somewhat engineering where the "changing from C to C++
because it's cool" ideas spontaneously may not mean the best solution at
least ...

That is what I want to say, and not that "C++ is sux" or whatever. Yes, I
can't code C++ and I don't like C++, but it's my private optionion, and it's
a very different story (mainly flame only style) so let's keep it away for a
development mailing list :)

- Gábor




More information about the MPlayer-dev-eng mailing list