Jump to content

  • Log In with Google      Sign In   
  • Create Account


What makes C++ so powerful?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
148 replies to this topic

#21 tstrimple   Prime Members   -  Reputation: 1718

Posted 09 May 2006 - 04:52 AM

Quote:
Original post by jwalsh
Quote:

VB provides a WYSIWYG editor which makes it easier for people to jump right in and see results.

So does C++ and C#.

Cheers!


He was making a comparison between C++ and VB therefore C# was out of context. I believe VC++ has a WYSIWYG editor but C++ in general does not. Of course the WYSIWYG editor for VB could also be seen as an IDE feature but VB is tied to that particular IDE a lot more then C++ is to any IDE.

Sponsor:

#22 phantom   Moderators   -  Reputation: 6702

Posted 09 May 2006 - 04:55 AM

Quote:
Original post by TheTroll
Spoonbender, I have to disagree with you there, having direct control over memory and the use of pointers gives C++ a huge advantage over other languages. You might not use this but a lot of us do.


smoke, mirrors and illusions my friend.
You don't have 'direct control over memory' on ANY modern OS, just try writing to somewhere you haven't been given and watch the OS jump all over you, scream at you and shut you down.

Pointers are just another way to screw up and the area most people new have the biggest trouble with, no advantage here.

Don't get me wrong, I'm primarily a C++ programmer, but neither of those are 'advantages'




#23 TheTroll   Members   -  Reputation: 882

Posted 09 May 2006 - 04:56 AM

A language does not have a WYSIWYG editor, none of them. What does have a editor is the IDE. The editor has nothing to do with the langauge, it is just an IDE tool for helping you design your UI.

theTroll

#24 JWalsh   Moderators   -  Reputation: 462

Posted 09 May 2006 - 04:57 AM

Quote:
Original post by tstrimp
Quote:
Original post by jwalsh
Quote:

VB provides a WYSIWYG editor which makes it easier for people to jump right in and see results.

So does C++ and C#.

Cheers!


He was making a comparison between C++ and VB therefore C# was out of context. I believe VC++ has a WYSIWYG editor but C++ in general does not. Of course the WYSIWYG editor for VB could also be seen as an IDE feature but VB is tied to that particular IDE a lot more then C++ is to any IDE.


Basic doesnt have a WYSIWYG editor. Visual Basic does. Hence the "visual" part. C++ doesnt have a WYSIWYG, but Visual C++ does. They are the same thing really, and not coincidentally, both Microsoft inventions - and both standard with "Visual Studio." Its just that Borland/Inprise and other IDE makers have created their own "visual" tools for C++, while no one has bothered with Basic that I know of.
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints

#25 Zyndrof   Members   -  Reputation: 163

Posted 09 May 2006 - 04:59 AM

Hmm... Whenever I start to feel that I have a little hang of this programming thing, more questions comes to mind and more answers makes more questions :P

I recently won a book on VB.net and am trying to decide if I should focus on C++ at the moment or start VB.net instead. It's hard not to use the book that lies waiting in the shelf :/

If my long-time goal is to start (or at least try) game programming, would VB.net be an alternative? The thing is, if I like doing game programming, there shouldn't be any problem switching to a more suitable language for the task. But if I find out I don't like it and want to stick with regular applications, what are the pros and cons of C++ and VB.net?

#26 Oberon_Command   Crossbones+   -  Reputation: 1782

Posted 09 May 2006 - 05:02 AM

Quote:
Original post by Zyndrof Is there any language that can compare with C++?


D. It's got a lot of the advantages of languages like C# and Java (garbage collection), but it's compiled to native code, so it doesn't need a bytecode interpreter. It doesn't have a preprocessor, but what there is is an improvement.

For example, instead of the C/C++ #include, we have import:


import std.c.stdio


Instead of:


#include <stdio.h>


D also doesn't need a #pragma once directive or #ifdef/#define/#endif blocks, since the import directive takes care of that for you.

There's lots of other stuff, but I don't want to make my post too long. [grin]

The one problem with it is that since it's so young, it doesn't have a very large codebase, and not many libraries have been ported to it yet (though I believe a port of SDL and some other APIs, similar to the .Net Tao project, is in progress).

edit: Forgot to mention FreeBASIC. [grin] FreeBASIC is much like C, but it's got a syntax that is very close to English, so it's good for beginners in most cases. It's fast, too, and in some cases it's actually faster than C/C++. When they get OOP working properly it'll be even better.

[Edited by - Oberon_Command on May 9, 2006 4:02:08 PM]

#27 templewulf   Members   -  Reputation: 526

Posted 09 May 2006 - 05:06 AM

Quote:
Original post by Zyndrof
Hmm... Whenever I start to feel that I have a little hang of this programming thing, more questions comes to mind and more answers makes more questions :P

I recently won a book on VB.net and am trying to decide if I should focus on C++ at the moment or start VB.net instead. It's hard not to use the book that lies waiting in the shelf :/

If my long-time goal is to start (or at least try) game programming, would VB.net be an alternative? The thing is, if I like doing game programming, there shouldn't be any problem switching to a more suitable language for the task. But if I find out I don't like it and want to stick with regular applications, what are the pros and cons of C++ and VB.net?


When you become a "good programmer" you won't be using just one language. Start wherever you can and learn as much as you can about as many languages as you can. A good programmer doesn't try to fit a square peg into a round hole, or use a language in a task for which it is ill-suited.

Perhaps the wisdom of Miyamoto Musashi might help here:
Quote:
"You should not have a favourite weapon. To become over-familiar with one weapon is as much a fault as not knowing it sufficiently well."

More specifically, I don't like VB very much, but it's easy to learn. If you're technically savvy, you could set up a python interpretor, and try that language instead. Your goal should just be to start learning and never stop.

#28 rohde   Members   -  Reputation: 432

Posted 09 May 2006 - 05:06 AM

Quote:
Original post by Zyndrof
Hmm... Whenever I start to feel that I have a little hang of this programming thing, more questions comes to mind and more answers makes more questions :P

I recently won a book on VB.net and am trying to decide if I should focus on C++ at the moment or start VB.net instead. It's hard not to use the book that lies waiting in the shelf :/

If my long-time goal is to start (or at least try) game programming, would VB.net be an alternative? The thing is, if I like doing game programming, there shouldn't be any problem switching to a more suitable language for the task. But if I find out I don't like it and want to stick with regular applications, what are the pros and cons of C++ and VB.net?


Look, my feelings on this are that you're wasting too much time trying to make the "perfect" choice with regards to which language to choose. There is no "perfect" language. Of course some languages are more suited at tackling some problems while other languages are more well suited for other areas of programming.

BUT If you're just starting out and want to do some grame and/or graphics programming, either VB.NET or C++ are adequate. Just pick one at random or whatever.

I would recommend C++ based on the fact that most game/graphics resources use C++, but that's just me. Other people will suggest VB.NET, other C#, other Python. It really doesn't matter - just get cracking my friend. [smile]
"We confess our little faults to persuade people that we have no large ones." -Francois de La Rochefoucauld (1613 - 1680). | My blog

#29 superpig   Staff Emeritus   -  Reputation: 1825

Posted 09 May 2006 - 05:13 AM

Quote:
Original post by Zyndrof
I recently won a book on VB.net and am trying to decide if I should focus on C++ at the moment or start VB.net instead. It's hard not to use the book that lies waiting in the shelf :/
I'd recommend picking one language and sticking to it, at least until you reach an 'intermediate' level with it. If you stick with C++ for now, and use it until you're comfortable, then when you switch to VB.net you'll find that many of the concepts in the language are the same.

If you've got a bunch of languages that can do the same thing, they'll usually 'evolve' the same sort of features, because that's what the situation demands of them.

(Have you ever wondered that the majority of living creatures on this planet have eyes? That's because eyes are a useful "feature" for survival when there's a lot of interesting different colours and lights around. If the planet were pitch-black, nobody would have bothered evolving them because they'd be useless).

#30 Xai   Crossbones+   -  Reputation: 1328

Posted 09 May 2006 - 05:17 AM

Quote:
Original post by Zyndrof
How come there haven't been any language to surpass C++ in these 26 years?


There have been languages to surpase C++ in 26. First an foremost, C++.

The C++ that existed even 15-20 years ago (such as Microsoft C/C++ 7.0, Borland Turbo C++ 3.0, etc) was NOT the same as the C++ that was created and then standardized between 1993-1998 - with templates and the STL. The addition of templates and an amazing library concept revitalized C++ in time when it would have started a dramatic decline in comparitive productivity against languages like Java, Python, ruby, etc ...

Even the final details thare are the difference between what non-compliant Visual C++ 6.0 can do vs. almost completely compliant Visual C++ 7.1 are enourmous in terms of that final touch needed to write ultra-powerfull, cleanly designed, and highly performant libraries. (When I say cleaning designed in this context, I mean EXTERNAL design, not the internal implementations design which is often very very tedious).

Other languages let developers get more work done - but C++ lets developers get a whole lot of work done, while letting the computer get more work done. (I'm not saying most C++ programs are significantly more efficient than other more modern languages, I'm saying C++ programs have the option of pursuing that path when necessary).

#31 RichardoX   Members   -  Reputation: 175

Posted 09 May 2006 - 06:13 AM

What makes C++ a powerful language, when not taking language or platform-specific frameworks (.NET, J2SE, MFC, etc) into account is that it has a lot of different features that can be used.

In particular, the following features are what makes C++ great:
-Templates. The ability to write type independent code gives a great advantage. Templates make it possible to write a piece of code once and then use it with many different types and/or other configurations without having to make abstractions or writing the same code many times.
-References. References give you the power of pointers with compile time sanity checking. The automagic referencing in Java seems a little awkward to me. Languages with no references or pointers need some way to pass data back and forth to procedures and functions, which is either done by global variables or moving lots of data back and forth to the procedure and it's caller.
-Operator overloading. This is a great feature. Together with templates, operator overloading makes some tasks a lot simpler, take std::sort for example. In game programming, it's convinient to have mathematical operators without doing something like Matrix.multiply(Vector). What I don't like is the way that they are used in C++ streams, but it's a matter of opinion.
-Object oriented programming, virtual functions, etc. These are pretty much in every other language too. But worth mentioning, tho. On the other hand, OOP makes bad programmers' code even worse, when they start using overkill design patterns for simple tasks.
-It compiles into native code. 'nuff said.

Things that could have been done better in C++:
-Interfaces. There are no Java-like interfaces in C++. You can use multiple inheritance, but that is much much more complicated than using interfaces in Java.
-The fact that C++ standards are relatively young. C++ is constantly evolving, even the most basic features of the actual language, not just STL and other frameworks surronding it. This is frustrating, because you will have to learn new features of C++ as it develops. On the other hand, the new standards are backwards compatible, and thus they may suffer from some legacy stuff compared to all-new languages and environments.

Some bad things about C++ when taking platform and/or language specific frameworks into account:
-The lack of a standard framework. The amount of standard C++ stuff is very little compared to Java, for example. There is STL providing some neat stuff, tho.
-The need of using C code. You will most likely need to use various different libraries when doing a project. Most of them are C-only. Some people (IMO) waste a lot of time wrapping C into C++.
-Using different libraries doesn't give you that consistent API and naming convention there is in Java, for example. Of course there is the OpenGL-like naming movement (OpenAL, DevIL, etc). Windows and MFC users have adopted the hungarian notation and naming convention, which gives some consistency, tho.

There really isn't anything good what I can say about C++ and it's frameworks. I have not used MFC, because it's windows-only, I have no experience of DirectX, either. They might provide a nice and consistent API for windows programming (or then not).

The problem with Java is that it was designed badly in the first place. There is no operator overloading, no templates and the automagic referencing is pretty strange. And when it comes to the framework, the awful AWT of Java 1.x and it's legacy in the more recent versions have caused me a lot of premature hair loss. There is a lot of deprecated stuff in the Java framework, which have not been removed and are unlikely to be removed in close future. This makes the java framework a bit bloated and slow.

I have never used C# so I can't compare C++ to it. I've heard it's pretty good, tho. I can't compare .NET to other frameworks either.

What I am currently into is Python. I like programming with it, because it gives me a lot of freedom. On the other hand, the freedom I get is away from the power of C++. I like the syntax, too. Less {, [, ], }, ( and )-charactes needed and it's still readable.

This is my opinion about the matter. I hope I don't inflict a flame war on the subject. I have a bad habit of doing that.

-Riku



#32 Spoonbender   Members   -  Reputation: 1254

Posted 09 May 2006 - 07:16 AM

Quote:
Original post by Zyndrof
Hmm... Whenever I start to feel that I have a little hang of this programming thing, more questions comes to mind and more answers makes more questions :P

I recently won a book on VB.net and am trying to decide if I should focus on C++ at the moment or start VB.net instead. It's hard not to use the book that lies waiting in the shelf :/

If my long-time goal is to start (or at least try) game programming, would VB.net be an alternative? The thing is, if I like doing game programming, there shouldn't be any problem switching to a more suitable language for the task. But if I find out I don't like it and want to stick with regular applications, what are the pros and cons of C++ and VB.net?


In the long term, it won't make any difference. In the short term, C++ has a steep learning curve, so another langauge might be better suited for beginners. But as I said, once you've got started, it doesn't matter either way. It won't be a handicap in the long term that you started with something other than C++, that's for sure. So basically, don't worry. Pick a language at random, and try to learn it. [smile]

Quote:

Spoonbender, I have to disagree with you there, having direct control over memory and the use of pointers gives C++ a huge advantage over other languages. You might not use this but a lot of us do.

What do you use it for? Is it something that couldn't be done in Java or C#? Do you actually *need* "direct" (although as was mentioned earlier, this is an illusion) memory control? The only time you *need* this is when writing low level drivers or kernels and similar. For everything else, you *could* just let the compiler handle memory management, if you used a language that allowed it. (Of course, in some circumstances this might be slightly slower, but that's not important here. I'm just pointing out that you don't *need* this low-level control)

Of course you use it as long as you're programming in C++, because C++ doesn't really offer a framework that can handle it for you.
If you were working in C#, I doubt you'd *need* it.
If you really disagree with me, then show me a program in C++ that couldn't have been made using C#.

#33 Oberon_Command   Crossbones+   -  Reputation: 1782

Posted 09 May 2006 - 07:33 AM

Quote:
Original post by Spoonbender
If you really disagree with me, then show me a program in C++ that couldn't have been made using C#.


An operating system? You would need a C# compiler that compiles to native binary, and to the best of my knowledge there aren't any...



#34 ronkfist   Members   -  Reputation: 100

Posted 09 May 2006 - 07:43 AM

I think its more of a question "what language not to pick". The only language of all the ones ive tried that I wouldnt recommend using is VB (not .NET), VB is getting old, isn't supported by MS anymore and so on..

I'd suggest starting with a fairly young OO language like Java or .NET(C#, VB.NET,...), once you get a hang of these it will be easier to switch to C++ if you will ever feel the need to.

#35 Oluseyi   Staff Emeritus   -  Reputation: 1670

Posted 09 May 2006 - 07:59 AM

Quote:
Original post by RichardoX
In particular, the following features are what makes C++ great:
-Templates.
-References.
-Operator overloading.
-Object oriented programming, virtual functions, etc.
-It compiles into native code.

None particular to C++. None exceptionally implemented in C++. I remember reading in an old issue of The C++ Report a comment by someone credited as the "inventor of templates" to the effect that, "When I invented templates, C++ was not what I had in mind." Admittedly, C++ has undergone significant revision since.

Fundamentally, there's nothing special about C++. It's a powerful language, but not significantly more so than dozens of alternatives. It's an efficient language, but it doesn't exactly blow the competition out of the water (and it lags badly in certain contexts). It's feature-rich, but mostly in comparison to C. What's really special about C++?

Legacy. It piggy-backed on C, which had enjoyed immense popularity as the first portable systems programming language. C++ is too verbose and large to be a systems programming language (unless you restrict yourself to a subset), and too arcane and under-powered to serve as a contemporary applications programming language. The Standards Committee knows this, so look for some significant enhancements/revisions with the next standard (or just take a look at some of the current drafts).

Quote:
Original post by Oberon_Command
An operating system? You would need a C# compiler that compiles to native binary, and to the best of my knowledge there aren't any...

THere weren't any native C++ compilers once upon a time, either, but they were written.

#36 dagbud   Members   -  Reputation: 138

Posted 09 May 2006 - 08:04 AM

I remember when I was first starting out. I played around with Quick Basic *shivers*, then went up to Pascal, learned C and finally C++. All the while only programming games. Along the way I played around with other languages as well such as FORTRAN, LISP, Object Pascal, and Visual Basic... Once you get the concepts of programming down, then you should be able to pick up a book or some documentation and put another language on your belt. Each language has it's own positives and negatives. The whole idea is very subjective so I won't try to tell you what is better. But if you're just starting out I would suggest something simple such as C# or Java since you can get something to show for your efforts very quickly. So, have fun learning.

-Dagbud

#37 Zyndrof   Members   -  Reputation: 163

Posted 09 May 2006 - 08:24 AM

Okay, I feel me questions have been answered and I will give .NET a shot and see how it works for me. I will also try to get into C++ in school (they have a course which demands you to have read another programming course which I haven't).

Thank you all for your help, and I promise I will try not to think about languages and instead think about programming :P

#38 Zahlman   Moderators   -  Reputation: 1678

Posted 09 May 2006 - 08:36 AM

Quote:
Original post by Oluseyi
I remember reading in an old issue of The C++ Report a comment by someone credited as the "inventor of templates" to the effect that, "When I invented templates, C++ was not what I had in mind." Admittedly, C++ has undergone significant revision since.


Oddly enough, the same thing was said by Alan Kay about OOP. :)

Quote:

Legacy. It piggy-backed on C, which had enjoyed immense popularity as the first portable systems programming language. C++ is too verbose and large to be a systems programming language (unless you restrict yourself to a subset), and too arcane and under-powered to serve as a contemporary applications programming language. The Standards Committee knows this, so look for some significant enhancements/revisions with the next standard (or just take a look at some of the current drafts).


QFE.


#39 vetroXL   Members   -  Reputation: 295

Posted 09 May 2006 - 08:37 AM

C++ is good if you really need to squeeze those last cpu cycles out of your system. I.E. We use it here at work to model Electronic Warfare tools. Something that C#, java or whatever, can't even touch with a 10 foot pole... of course, if the algorithm is effeciant and you don't need that level of performance all the other languages are more than optimal these days... I wouldn't write another GUI in C++, I would use C# or Java or something... they have greate interopability (sp) these days... I would rather spend time working on my game than writing GUI code in C++ ( shiver )...

Game in GDS

#40 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Posted 09 May 2006 - 08:38 AM

Quote:
Original post by RichardoX
The problem with Java is that it was designed badly in the first place. There is no operator overloading, no templates and the automagic referencing is pretty strange. And when it comes to the framework, the awful AWT of Java 1.x and it's legacy in the more recent versions have caused me a lot of premature hair loss. There is a lot of deprecated stuff in the Java framework, which have not been removed and are unlikely to be removed in close future. This makes the java framework a bit bloated and slow.

I have never used C# so I can't compare C++ to it. I've heard it's pretty good, tho. I can't compare .NET to other frameworks either.


This is the usual unbacked claim here in gamedev.net . People assume C# is better because of emotional appeal, maybe the 'C' in the name makes them feel better about it. It gives some impression that's a sequel to C++, doesn't it?

I think what nobody mentions about Java is that ALL methods and classes that are deprecated are marked so, the IDE will warn you about them, and the Javadocs tells exactly what to use instead. Unless you have VERY good reasons for using them there's no need to use it, and that wouldn't make Java slower either.

I can't really understand why anyone trying to find something "to talk about Java" touches this subject. Any project manager could tell you how much the developer hour cost and how much budget you have available for making things to work. So, would you prefer to rewrite your application, and sometimes redesign it, because of "no backward compatible changes" from one version to another?

An average Joe could see this and be eager to type:

"But why would anyone want to update to a new version!? Couldn't I just choose which one to use?"

- Performance updates;
- Library updates that bring new features for using in your projects that save LOTS of time (like the concurrent utilities in Java 5);
- Language updates;
- Bug fixes;
- etc.

They will need to clean that up one day, but radical changes are not good, except if you are Microsoft and your monopoly makes developers endure the pain or if you are an open source developer whose projects are a mess.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS