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

2010-09-12 Thread Kurt H Maier
On Fri, Sep 10, 2010 at 2:26 PM, Szabolcs Nagy n...@port70.net wrote:
 i once looked into this, here is what i've found:
 http://port70.net/~nsz/16_c++.html
* quote:
  c++; /* this makes c bigger but returns the old value */

This is utterly brilliant.




-- 
# Kurt H Maier



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

2010-09-12 Thread hiro
This is how I remember where ++ does what :D

On 9/12/10, Kurt H Maier karmaf...@gmail.com wrote:
 On Fri, Sep 10, 2010 at 2:26 PM, Szabolcs Nagy n...@port70.net wrote:
 i once looked into this, here is what i've found:
 http://port70.net/~nsz/16_c++.html
 * quote:
   c++; /* this makes c bigger but returns the old value */

 This is utterly brilliant.




 --
 # Kurt H Maier





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

2010-09-11 Thread Paolo
One of my maxims is that everyone mistakenly thinks that the kind of
programs that they write are the kind of programs everyone writes.

There are arguments against C++. Nothing more than that.
I'd use Python to check md5 hash of my downloads

$alias md5.=python -c \import hashlib; print 
hashlib.md5(open('$1').read()).hexdigest()\

Should I write md5.py, I could port it on M$Win and with Autohotkey I could 
make it
start when I middle-click a file on explorer and pop the result up in the tray,
with 3 more lines of code.

Of course this could suck less. Python and Autohotkey require interpreters and 
libraries.
Who cares. I could write it in C of course. But this is the first thing that 
comes to my
mind that gets the job done, sucks relatively, it's damn fast to write, easy to 
read and
it's good to me because I use those interpreters for a load of things.

 Why program in C++ when you can do it in C, making the program simpler and 
 better?
When you can't make the program simpler and better, or you need to do it faster
than you do in C, just write C++ or whatever.

This is just the place where people write about C, little overheads and simpler 
programs.


---
Wyrmskull lordkran...@gmail.com



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

2010-09-11 Thread Nicolai Waniek
On 09/10/2010 07:46 PM, v4hn wrote:
 On Fri, Sep 10, 2010 at 08:19:38PM +0300, Nikhilesh S wrote:
 I haven't really understood the problems with C++ that the people here
 that have problems with C++ have[...]
 
 Felix von Leitner gave a pretty good presentation in 2007 on such problems :)
 
 http://www.fefe.de/c++/c%2b%2b-talk.pdf
 

From looking at FeFe's presentation just some notes: His complaints are
mostly corner cases. You can produce some stupid corner cases where the
language sucks for every language.

Additionally from someone who can't properly code (look at his open
source stuff...) one should simply stop reading when he's complaining
about possibly cryptic compiler output...



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

2010-09-11 Thread David Tweed
On Sat, Sep 11, 2010 at 10:40 AM, Paolo lordkran...@gmail.com wrote:
 Why program in C++ when you can do it in C, making the program simpler and 
 better?
 When you can't make the program simpler and better, or you need to do it 
 faster
 than you do in C, just write C++ or whatever.

 This is just the place where people write about C, little overheads and 
 simpler programs.

The point I was making was just that there are SOME problem domains
where the features C provides fit what's needed and the C++ features
aren't useful, in which case C will be simpler and better. And it's
great to use it in those cases. But there are SOME other problem
domains where some of the features C++ provides that aren't in C are
incredibly useful in writing really clean, maintainable and more
efficient code, and as such I don't think that a blanket statement
Why program in C++ when you can do it in C, making the program
simpler and better? is accurate. Choose the language that's best for
the particular problem you're solving at the time is all I was saying.


-- 
cheers, dave tweed__
computer vision reasearcher: david.tw...@gmail.com
while having code so boring anyone can maintain it, use Python. --
attempted insult seen on slashdot



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

2010-09-11 Thread v4hn
On Sat, Sep 11, 2010 at 01:59:07PM +0200, Nicolai Waniek wrote:
 From looking at FeFe's presentation just some notes: His complaints are
 mostly corner cases. You can produce some stupid corner cases where the
 language sucks for every language.

Sure, but it's quite easy for C++ ;)
After all this was a c++ bashing presentation, so there was no need to add
a lot of 'real' arguments.

However Nikhilesh asked for problems with C++ that the people here
that have problems with C++ have, and there are a number of really good
examples in the slides :)

 Additionally from someone who can't properly code (look at his open
 source stuff...) one should simply stop reading when he's complaining
 about possibly cryptic compiler output...

:D I do know his codes^^.
However he does know something about auditing code and about hacking
especially with C/C++ code.
And in security research those corner cases are the most interesting ones.


v4hn



pgppiU9ckNLqY.pgp
Description: PGP signature


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

2010-09-11 Thread matus,
On Sat, Sep 11, 2010 at 10:58:19PM +0100, David Tweed wrote:
 On Sat, Sep 11, 2010 at 10:40 AM, Paolo lordkran...@gmail.com wrote:
  Why program in C++ when you can do it in C, making the program
  simpler and better?
  When you can't make the program simpler and better, or you need to
  do it faster than you do in C, just write C++ or whatever.
 
  This is just the place where people write about C, little overheads
  and simpler programs.
 
 The point I was making was just that there are SOME problem domains
 where the features C provides fit what's needed and the C++ features
 aren't useful, in which case C will be simpler and better.
 [snip]

wmi started out in C++.  The ideas there evolved into wmii and then dwm.
The current philosophy of simple, orthogonal tools came from a dark,
complicated past, where C++ was a player.  As such, there is a sort of
automatic disdain for C++.

This of course is only my interpretation, but perhaps a historical
perspective on why this philosophy is somewhat antithetical to
principles embodied by C++.  Perhaps Anselm can comment further.

(The fact that C++ has weaknesses is documented everywhere, and readily
apparent.  The other fact that C++ also has great strengths, and
provides useful tools for certain problems, is also readily apparent.)



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

2010-09-10 Thread Nikhilesh S
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
http://www.nikhilesh.info



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

2010-09-10 Thread Paolo
Uriel has a page on that, you can find some link there.
http://harmful.cat-v.org/software/c++/

C++ inserts a serie of unneeded complexity to the straightforwardness of C.

If you think object-orientedly, you sure imagine a lot of Player objects each 
with a
Position object (x,y,z) referenced to a Scenario object.

Lists also exist in C. You could write instead a C program which is a 
PlayerManager,
which spawns n Player threads, and communicates with another program which is 
a Scenario.
This would remove the need of a big monolithic program and would add to 
modularity.
You could spawn every Player routine from a PlayerManager program which would
communicate with a Scenario program which represent the game's Universe.

Let's also add that an addictive game doesn't have to have full blown graphics,
think about puzzle games, arcades, Pet Society, Farmville, Ogame.
Roleplaying games mainly involved text for some decade, and we could mention 
Crobots.

Why program in C++ when you can do it in C, making the program simpler and 
better?

GObject-like things is about thinking objects in a non OO language. It's just 
bad imho.

C++ is understood fully by people here (not talking about myself), but people 
do have
their opinion, likes and dislikes.

---
Wyrmskull lordkran...@gmail.com



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

2010-09-10 Thread Szabolcs Nagy
* Nikhilesh S s.nikhil...@gmail.com [2010-09-10 20:19:38 +0300]:
 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 once looked into this, here is what i've found:
http://port70.net/~nsz/16_c++.html



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

2010-09-10 Thread Ramil Farkhshatov
There is a good analysis of C++ monstrosity: http://yosefk.com/c++fqa
-- 
Ramil Farkhshatov




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

2010-09-10 Thread David Tweed
On Fri, Sep 10, 2010 at 7:19 PM, Paolo lordkran...@gmail.com wrote:
 Why program in C++ when you can do it in C, making the program simpler and 
 better?

One of my maxims is that everyone mistakenly thinks that the kind of
programs that they write are the kind of programs everyone writes.
There are some domains in which C is simpler, there are some domains
in which C++ yields simpler programs, assuming you account carefully
for all the complexity caused by macros and conventions which have to
be ensured by the programmer. (Incidentally, I think the I only use
10 per cent of the language, so it must be bloated are people who
don't realise not everyone writes the kind of programs they do, and
would presumably also object to a natural language which is big enough
to be usable by both poets and lawyers. Now, complaints about the bad
interaction between C++ features are more justified...)

My opinion on C++ is, basically, every major feature in C++ is in
response to a real difficulty in programming that's worth attempting
to ameliorate, but the solutions chosen by C++ are often suboptimal,
and very often interact badly with other features. I'm also of the
opinion that many of the worst elements of C++ are due to the design
requirement to in essence have a block of code which is valid C have
the same semantics as in C (and to some extent the desire to keep
using object file/linker formats bassed in the 70s); that strongly
constrains some important basics to annoying things. My biggest
concern about the latest evolving standard C++0x is that it attempts
to cram even more functionality into a design space that's already
highly constrained by both C compatibility and existing C++
compatibility. Of course, Stroustrup argues that C++ wouldn't have
become popular had it not constantly been presented as incremental
evolution.

A lot of my work is writing numerical code that is quite performance
critical. As such, I find it almost invaluable to be able to write a
template function so that one source base can work on int8_t's, ,
floats, doubles, complexfloat, etc, with proper typechecking rather
than in C with kludges using macros that render debugging a nightmare.
That combined with C++'s namespaces (which whilst not a proper module
system, are a godsend if you need to QUICKLY create a program which
uses two existing libraries that happen to use the same name) is
enough to mean that, FOR MY KIND OF PROGRAMMING, I'd rather use MY
subset of C++ that doesn't have bad interactions than have to write in
C doing lots of C++ stuff by hand. But I expect some people working on
other kinds of problems have their own subset of C++ that they use,
and some people working on other kinds of programming are best served
by C.

So for me, C++ is basically a good idea with a botched implementation,
and I think it's a bit of a shame that D Java has semantics designed
for a managed interpreter, D still appears to be primarily supported
by a few developers, that Go does not have any interest in efficient
numerical computation, BitC appears to have only one developer, etc.
To be honest, if it wasn't so heavily based on an ecosystem, and
possibly legal issues, that are controlled by Microsoft I might have
tried moving to C#.

-- 
cheers, dave tweed__
computer vision reasearcher: david.tw...@gmail.com
while having code so boring anyone can maintain it, use Python. --
attempted insult seen on slashdot



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

2010-09-10 Thread Kris Maglione

On Fri, Sep 10, 2010 at 08:19:38PM +0300, Nikhilesh S wrote:

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).


Wow you write long emails for flame-bait...

There's a very good quote to answer your question in brief,

C++: an octopus made by nailing extra legs onto a dog.


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, ... ).


Please don't mention GObject. Nearly anything GNU is not worth 
mentioning.



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?


It's not OO that we're against. Not per se, anyway. It's that 
C++ is simply a poorly designed hodge-podge that basically nails 
a lot of extra features on C, without any real core design 
principles, and incidentally kept the heinous old textual 
preprocessor and added yet another symbolic preprocessor just to 
insult to insanity. For an example of what C++ should have been, 
have a look at D, which is easily as simple as C and more 
powerful than C++. And now there's Go, and there's always been 
Lisp and Objective-C, both of which have cleaner designs than 
C++ and follow the original Object Oriented model much better 
than the latter.


--
Kris Maglione

You do not really understand something unless you can explain it to
your grandmother.
--Albert Einstein