Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Why C++ sucks: Not Flame Bait

This thread is locked; no one can reply to it. rss feed Print
 1   2   3 
Why C++ sucks: Not Flame Bait
Johan Halmén
Member #1,550
September 2001

http://www.allegro.cc/files/attachment/593131 http://www.allegro.cc/files/attachment/593130

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

Jakub Wasilewski
Member #3,653
June 2003
avatar

Yeah, I remember being quite surprised when I first saw an exchange in which Linus Torvalds was involved. Though I wasn't very well versed in Linux those days, I had quite a lot of respect for the project, and the people involved. Torvalds was basically a symbol of all the effort that has gone into creating Linux, and my attitude towards him was really quite positive.

And then I saw what was supposed to be a sane discussion about some aspect of programming or the other. Everyone kept their cool, which is to be expected from developers I guess. Linus Torvalds was like a rabid dog.

I understand having strong feelings about one programming paradigm or another. I even understand why he would have enough self-esteem to fill a Zeppelin - whether I like him or not, he earned it. But for the love of god, you have to have some dignity. Noblesse oblige, one could say.

Especially if you are considered an authority, you shouldn't burst into flames every time someone disagrees with you. High self-esteem should be the exact reason to shut up and let people discuss among themselves. And if you do have something to say (and you know it will be remembered because of your position), make it something insightful and well-founded. Crushing some poor clueless guy doesn't cut it, I'm afraid.

While I still have respect for Linux, I no longer think Linus has that much to do with what Linux is. I know now that being the "founder" of Linux mostly meant providing some basic blocks making up the OS. Even in the early days, most of the work was done by other people, and many many things were borrowed from GNU in order to make it fully functional. He just started the right project at the right time.

EDIT: Oh, and:
http://www.allegro.cc/files/attachment/593132

---------------------------
[ ChristmasHack! | My games ] :::: One CSS to style them all, One Javascript to script them, / One HTML to bring them all and in the browser bind them / In the Land of Fantasy where Standards mean something.

Myrdos
Member #1,772
December 2001

I saw the video of Linus giving a speech on Git to a room packed with Google employees. He compared Git to subversion (a Google product), and called the implementors morons and idiots. Acted like quite a jerk, really.

But I must admit, Git is a brilliant invention for managing the Linux kernel, because it's completely decentralized. I realized that no one is in control of the Linux kernel. See, anyone can make a branch of the kernel. But then, you have to convince people to use your modifications, or 'pull from you' in Git terminology. Other developers can do a diff and see what changes you made before accepting. Each developer has a network of a few friends he pulls from, and these have their own network of friends, etc.

As I understand it, there are 5 major branches of the kernel that people are interested in - only one of them is Linus's version. So if Linus starts losing credibility or making bad decisions, his branch will become less popular and diminish in importance. And if he does good work and doesn't ruin his good name, his branch will remain popular.

__________________________________________________

ImLeftFooted
Member #3,935
October 2003
avatar

Quote:

You are all not better than Linus... If you want to be better than him, follow the suggestion of ixilom. He has a good point.

Sure but I am and I'm part of "you all" so "us all" are better then Linus by association with me.

Sevalecan
Member #4,686
June 2004
avatar

Quote:

C: "Hi, I'm C!"
C++: "..."
C: "Oh, that's C++. He's still compiling right now."

su
**********
cd usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4
g++ -c -x c++-header iostream

<C> Hi, I'm C!
<C++> And I'm C++.
<C> Holy shit, where did you come from? I thought you were still compiling.
<C++> n00b.

I've found precompiling C++ headers can help alot. iostream is a bitch.

TeamTerradactyl: SevalecanDragon: I should shoot you for even CONSIDERING coding like that, but I was ROFLing too hard to stand up. I love it!
My blog about computer nonsense, etc.

TestSubject
Member #8,989
August 2007
avatar

C++ is trash? Augghhh every time I try to learn a language it turns out it isn't what I am looking for. Visual Basic was really easy, but...not for games. Never learned C, just got C++. Why does the world hate me so!

BAF
Member #2,981
December 2002
avatar

Just because some people (including me) don't like C++ doesn't mean it's trash for you. If you like C++, use it. The whole part about being a programmer is having a broad knowledge of languages, and picking the appropriate one for the job.

Quote:

subversion (a Google product)

Since when is subversion a Google product? Tigris makes subversion...

TestSubject
Member #8,989
August 2007
avatar

Yeah, but I don't know which one is right for me. I guess I can stick on through C++ for a while, but spending my slowly earned money on books and my sparse time on learning it is kind of painful.

What parts of various languages are the same? Variables are, what about references, pointers, etc etc. Another reason I like C++ is because my mom did VB for her job, I have VS 2005 that I got for free. It is a pretty (visually) compiler (or whatever).

About pointers...say you have int val = 5; then you have int *pval in function my_func. Inside my_func, could you call a function my_func2(int pval2) and just pass pval? That would pass the address, correct? Then you could just use *pval2 inside my_func2 to get at val?

nonnus29
Member #2,606
August 2002
avatar

My_func2 would have to have a int pointer parameter like: my_func2(int *pval). I used to code in C++ (had to for school plus I made a couple of game demo's with it). I wouldn't say I ever reached a more than intermediate level with it. It's a good basis to start from with oop and what not, but... I'll leave it at that. It's just too complicated for what it is. Oops, pretend I didn't say that.

:-X

Edit; FYI, this was the best C++ book I found (imho):

http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html

BAF
Member #2,981
December 2002
avatar

VS 2005 should include VB.net, C#, and maybe even J# (some Java clone).

And you can download the Express version, which should work in most cases for most people, for free. Speaking of that, I have to find the copy of VS2005 I got from MS for free so I can install it, the .NET compact framework doesn't like VS Express for some reason.

As far as sending in to my_func2, you would have my_func2(int *pval2), then you can send the pointer in, and access it using *pval2.

kronoman
Member #2,911
November 2002
avatar

Going to the original post, Linus is too full of shit ; or should I say Linus is full of shit too... whatever...

the discussion resumes to Linus saying something similar to my d*ck is bigger than yours

Linus said:

The fact is, git is better than the other SCM's. And good taste (and C) is
one of the reasons for that.

can be translated to

King Nerd said:

The fact is that I'm a pedantic nerd, and I probably have a bigger d*ck than you...

Really, is sad to see this blue blood royalty genius going into a flame war...

"Arguing on the Internet is like running in the Special Olympics, even if you win you're still retarded".

axilmar
Member #1,204
April 2001

C++ is my favorite programming languages, but it sucks big time. It's the truth, we C++ programmers have to admit it.

Why does it suck?

Is it because it has lots of features? well, perhaps. It has a lot of corner cases, but quite a lot of people have managed to create multi-million line programs with it.

Is it because it has a strange syntax? it does. C++ tried to be like C. C is a simple language and its features bond well with its syntax. But not so with C++. But that is not a decisive factor. Just like any other language, after a while a typical programmer gets used to C++ syntax. It grows on you.

Is it because many things are left undefined by the standard? well, they are. There is no ABI, different compiler vendors implement things differently, etc. But that's not very important either. With a little help from the preprocessor, cross-compiler code can easily be written.

So what is it?

Is it because the standard library does not contain many useful abstractions?

Yeah, I dare say that that's the problem. Modern applications need a lot of functionality that C++ does not have:

1) threads
2) networking
3) gui
4) memory management
5) database support
6) xml support
7) unicode & internationalization
8) 3d graphics
9) parser
10) regular expressions
11) cryptography
12) file management
13) process management
14) registry management
15) a callback mechanism
16) plugin system
17) properties
18) reflection

And probably many more that I have forgotten about.

Any language without the above functionality would suck, to be honest. A language without an extensive SDK is useless.

But there is hope for C++ programmers after all.

At the risk of sounding like advertising a program (well, I do, but only because the product I am going to mention is so superior than anything else), there is product which covers most of the above! It is:

The Qt Toolkit

Using Qt, C++ is transformed from a language that sucks to a modern powerful language which combines best practices from most programming domains.

Programming C++ with Qt is a pleasure. Applications can be completed in a fraction of time of other solutions. The API is one of the most consistent and logically laid out APIs one could ever hope for.

Qt really shows the power of C++. I think that the C++ standards committee oughts to adopt Qt as the C++ standard library!

:-)

Slartibartfast
Member #8,789
June 2007
avatar

Kibiz0r
Member #6,203
September 2005
avatar

axilmar: There are libraries that do all of those things, and it's easy enough to abstract them all so you can switch libraries if you want. Things like callbacks are even trivial enough to write yourself.

Not saying Qt isn't nice (I've never used it), but there are alternatives, after all. C++ is versatile enough to be high-level and low-level at the same time, and I think that's where the problem lies. It gives the programmer the bricks, but also the wall. Libraries tend to give you the whole house.

On a side-note, whoever it was that was debating singletons with me in a thread a while back (I think it was Bruce Perry)... You were right.

They worked out fine for a while, but eventually I stretched it farther than the pattern allows for, and pretty soon I was trying to do some crazy ass-backwards stuff just to make it work and still keep the singleton-ness.

Just not worth it. And for what? What exactly did having those things singleton'd afford me? (except awkward syntax)

axilmar
Member #1,204
April 2001

Quote:

You're joking, right?

Qt supports OpenGL out of the box, for example.

Quote:

Not saying Qt isn't nice (I've never used it), but there are alternatives, after all. C++ is versatile enough to be high-level and low-level at the same time, and I think that's where the problem lies. It gives the programmer the bricks, but also the wall. Libraries tend to give you the whole house.

Of course, there are alternatives, but it's not easy to bridge the gaps between libraries, let alone maintain them.

I've noticed the same thing with Java: as long as you use the SDK, programming is nice. Once you have to use many different libraries, then the problems start.

HoHo
Member #4,534
April 2004
avatar

Quote:

Qt supports OpenGL out of the box, for example.

So do regular C and C++ ;)

Only thing is you'll have to do a bit more work to start using it. E.g open a window and load extensions.

Quote:

Of course, there are alternatives, but it's not easy to bridge the gaps between libraries, let alone maintain them.

I haven't yet tried but I don't think it is that simple to use other libraries together with QT

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

Michael Faerber
Member #4,800
July 2004
avatar

Also, Qt is not a 100% valid C++ library, because you can't compile code utilizing Qt with a normal C++ compiler. You have to translate the source files into valid C++ code with a special utility before compiling. At this point I stopped my Qt journey.

--
"The basic of informatics is Microsoft Office." - An informatics teacher in our school
"Do you know Linux?" "Linux? Isn't that something for visually impaired people?"

Slartibartfast
Member #8,789
June 2007
avatar

Quote:

You're joking, right?
Qt supports OpenGL out of the box, for example.

Let me rephrase that:

Quote:

... Modern applications need ... ... 3d graphics ...

You're joking, right?

Myrdos
Member #1,772
December 2001

BAF: We'll I'll be. That video sure made it seem like Subversion was a Google initiative. Linus even mentioned the possibility of Subversion developers in the crowd. Could it be that some Google employees contribute to Subversion as part of their personal development time?

__________________________________________________

axilmar
Member #1,204
April 2001

Quote:

Only thing is you'll have to do a bit more work to start using it. E.g open a window and load extensions.

You don't have to do that extra platform-specific work with Qt.

Quote:

I haven't yet tried but I don't think it is that simple to use other libraries together with QT

Library interoperability is a hot topic for most, if not all, languages. I haven't met a programming language where libraries can peacefully co-exist without extra work.

Quote:

Also, Qt is not a 100% valid C++ library, because you can't compile code utilizing Qt with a normal C++ compiler. You have to translate the source files into valid C++ code with a special utility before compiling. At this point I stopped my Qt journey.

Very true. I assume you are using the command line to compile your programs? Visual Studio has spoiled me (the process is automatic in VS).

Quote:

You're joking, right?

So, modern applications don't need 3d graphics?

My point is that a language is as useful as its libraries. The fact that a language has nice or ugly syntax or does not have lambda functions are not that significant.

HoHo
Member #4,534
April 2004
avatar

Quote:

You don't have to do that extra platform-specific work with Qt.

I know, I ported one ~5kloc QT program that used OpenGL from win32 -> lin64 in a couple of hours :)

Quote:

So, modern applications don't need 3d graphics?

My mail application can do without displaying 3D rotating annoyances just fine :)
Point is that you don't need to have built-in 3D support if you can get it with small addon libraries. There are many of those out there. One such is Allegro+AllegroGL ;)

__________
In theory, there is no difference between theory and practice. But, in practice, there is - Jan L.A. van de Snepscheut
MMORPG's...Many Men Online Role Playing Girls - Radagar
"Is Java REALLY slower? Does STL really bloat your exes? Find out with your friendly host, HoHo, and his benchmarking machine!" - Jakub Wasilewski

nonnus29
Member #2,606
August 2002
avatar

Quote:

My mail application can do without displaying 3D rotating annoyances just fine :)

What if you want to extend your email application to display a graph (node and edges) of the email traffic (a social network basically)? Then you'd need a graph drawing lib (or roll your own) and using hardware 3d to display it will give better performance for large graphs.

Maybe that examples a little far fetched; or maybe that's the type of feature that could make an email app stand out from the crowd (ie market success). Anyway, we're picking at inconsequential bits here.

The point is that well integrated libraries and library support in general expand what developers can conceive of doing with a language. The language/framework/ide are becoming the golden mean which is what I believe axilmar was getting at.

BAF
Member #2,981
December 2002
avatar

Quote:

"Arguing on the Internet is like running in the Special Olympics, even if you win you're still retarded".

Reminds me:

{"name":"arguing.jpg","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/0\/406060cb91dafc25e0bdc8b62fcdb74d.jpg","w":315,"h":466,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/0\/406060cb91dafc25e0bdc8b62fcdb74d"}arguing.jpg

Quote:

Could it be that some Google employees contribute to Subversion as part of their personal development time?

Certainly it could be.

axilmar
Member #1,204
April 2001

Quote:

The point is that well integrated libraries and library support in general expand what developers can conceive of doing with a language. The language/framework/ide are becoming the golden mean which is what I believe axilmar was getting at.

Exactly.

Regarding 3d, for example, there are many visualization possibilities opened up. Game tools certainly need that kind of functionality. For example, in a tile map editor, one would be able to show several layers of tiles in 60 fps using the 3d hardware inside the application window.

Slartibartfast
Member #8,789
June 2007
avatar

Quote:

Game tools certainly need that kind of functionality.

Game tools is a tiny subgroup of Applications.
I'd even dare say that "applications that need 3d graphics" are a tiny subgroup of "applications".

 1   2   3 


Go to: