[dev] [OT] What's wrong with C++?

From: Nikhilesh S <s.nikhilesh_AT_gmail.com>
Date: Fri, 10 Sep 2010 20:19:38 +0300

I must start out saying I don't have much experience in software
development with larger teams on large projects or with lots of other
people, or in 'commercial software development' in companies - I've
just done stuff as a hobby in my free time for the past 5 years or so,
learning on my own - but I hope to learn more in the coming years (going
to university next year).

Two langauges I've used a bit are C and C++.

I've used C++ in the past for writing games and other graphics programs,
and in my experience it has worked rather well for that. I must 'confess'
I've used inheritance a lot in this realm especially for 'GameObjects'
(Player, Monster, Box - whatever) - keep a large list of these objects, a
'manager' iterates through them per-frame (or whatever event) tells them
about it, and due to virtual function stuff each handles it differently
based on what type of object it is. In per-frame event, Player checks
for input and responds, Monster does movement stuff etc.

In C, to the best of my knowledge, either you would do this by having an
enum of types and 'switching' on it, or by doing a function pointer table
thing (which is functionally (no pun intended) equivalent to a virtual
function table right?). So aren't you just building the same idea on it
again? I've also seen in a lot of open-source C code some kind of attempt
at making OO-stuff in C such as the 'GObject' things. Often a lot of the
code is of the form somestruct_dosomething(struct somestruct *p, ... ).

I haven't really understood the problems with C++ that the people here
that have problems with C++ have, although I must say in recent years
(especially with C++0x?) they've been adding a lot of features and it's
getting a little 'fat'. Are you just feeling the same thing, just that
you probably used C before C++ or have otherwise been at it for a long
time and thus this feeling has come in earlier?

Maybe C++ is 'complex' but doing things with it is 'simple', whereas
it's the other way round in C? Look at ASM and C for instance - I've only
lightly touched ASM but I think it's simpler than C but doing things in
C is simpler than in ASM.

Is C++ broken because no one really understands it fully? Is allowing
multiple paradigms in a single langauge a problem? Should language
enforce paradigm?

Could you elaborate in detail, what exactly are your problems with C++?
Thanks. :)

I do not intend that you code in C++ or that suckless adopt C++ or
something - I simply want to see some opinions and maybe some instances
from real-life experience that would help me develop my own opinion
to help me decide on what language to use for programs I write in the
future. In fact I quite like C, but I don't dislike C++.

Nikhilesh S
Received on Fri Sep 10 2010 - 19:19:38 CEST

This archive was generated by hypermail 2.2.0 : Fri Sep 10 2010 - 19:24:02 CEST