hey null, you seem to be having trouble here...everyone seems to be against you. im with you.
C++ is a ''better C''. that is what it was initially designed to be. that is what it is.
Classes Vs. Straight Code
C++ sceptics: read "Design and Evolution of C++" by Bjarne Stroustrup - it discusses why C++ is how it is. if you dont see the usefulness of any C++ features, chances are you will once you read this book.
it'll set you back a pretty penny, so get it out of a library or something if you're low on cash (like me )
Edited by - POINT on June 28, 2000 7:07:25 PM
it'll set you back a pretty penny, so get it out of a library or something if you're low on cash (like me )
Edited by - POINT on June 28, 2000 7:07:25 PM
Sorry if this is off topic but here are the facts as I know them:
Both C and C++ are completely useless. That's right, useless. It's the programmer that will impose constraints or break barries regardless of which language/style you choose.
Edited by - deadlinegrunt on June 28, 2000 7:53:42 PM
Both C and C++ are completely useless. That's right, useless. It's the programmer that will impose constraints or break barries regardless of which language/style you choose.
Edited by - deadlinegrunt on June 28, 2000 7:53:42 PM
~deadlinegrunt
A far as I can tell C is a good language for getting down and dirty with the processor, of course if it''s speed your looking for go with assembler. C as with assembler can be embedded in c++ code within classes etc.
If you put as much effort in to learning c++ (actually leaning what it does under the covers) your c++ code will be ''almost'' as efficient as C for small to medium size projects. On a large project however the superior data\code organisation potential of C++ will most likely end up making C++ MORE efficient than C or assembler due to the much better organisation.
All this doesn''t even touched by special abilities of classes, so far I''m only talking about basic classes.
Things are looking good... (gimp is currently reading "Efficient C++", "STL programming from the ground up" and "Data structures and algorithms"). I DONT consider myself an expert on this subject but I do understand that I probably AM more advanced and hence can voice my opinions, than someone who would ask the question of ''what language is faster''.
I started with C and initially my C++ code looked like C inside classes (I was even still using malloc). Teese days I find classes a convenient way to make my program diagrams in to real code. Recently I''ve started looking at STL. My theory is, I''m not willing to waste an extra 20-30% of my programming time rewriting generic data containers and data modifiers. So even if C++ WAS completely evail and forced at 10% slowdown in code the 30% faster development for me would be worth it (imagine taking 4-5 months of debugging off your schedule)
Oh, and I like NULL_POINTERS type of posts.
gimpo
If you put as much effort in to learning c++ (actually leaning what it does under the covers) your c++ code will be ''almost'' as efficient as C for small to medium size projects. On a large project however the superior data\code organisation potential of C++ will most likely end up making C++ MORE efficient than C or assembler due to the much better organisation.
All this doesn''t even touched by special abilities of classes, so far I''m only talking about basic classes.
Things are looking good... (gimp is currently reading "Efficient C++", "STL programming from the ground up" and "Data structures and algorithms"). I DONT consider myself an expert on this subject but I do understand that I probably AM more advanced and hence can voice my opinions, than someone who would ask the question of ''what language is faster''.
I started with C and initially my C++ code looked like C inside classes (I was even still using malloc). Teese days I find classes a convenient way to make my program diagrams in to real code. Recently I''ve started looking at STL. My theory is, I''m not willing to waste an extra 20-30% of my programming time rewriting generic data containers and data modifiers. So even if C++ WAS completely evail and forced at 10% slowdown in code the 30% faster development for me would be worth it (imagine taking 4-5 months of debugging off your schedule)
Oh, and I like NULL_POINTERS type of posts.
gimpo
Chris Brodie
quote: Original post by null_pointer
#1 C++ provides better type-checking
#2 C++ provides operator overloading
#3 C++ provides classes
#4 C++ provides templates
#5 C++ provides polymorphism
#6 C++ provides a huge template library that can handle any data type in a type-safe way (STL).
#7 C++ supports function objects
#8 C++ is not slower than C *
#9 C++ is a better procedural language than C
#10 C++ is a better OOP language than C
#11 C++ is a better generic language than C
I'd refute #1, #8, #9, #10, & #11
#1 How so? C & C++ are both loosy typed lang's... asm is the only one less so. If you want type checking use a functional language (I *HATE* ML)...
#8 Comparing non-emulating C code to OOP designed C++ code (Apples to oranges IMNSHO) C is faster. I believe it takes 4 extra clock ticks per function call to copy that extra dword to the stack for this* It also takes an extra dereference if you use pCls->Something(), which is another 4 extra ticks for the additional mem->reg that is required (or is mem->reg faster now?). So on a Thunderbird 1200MHz machine it will take 6.7ns longer per method call . (The last time I compared the two, 486 33DX's were new and it would take 242.4ns longer on those - a considerablly bigger difference) *note* this example does not account for RAM wait states... which made the 486 even slower!
#9 Procedurally speaking, are they not exactly the same?
Or are you reffering to op overloading? and other such things that make C++ more readable?
#10 C++ is an OOP language. C is not. (Yes you can emulate OOP design in C, you can also dynamically allocate RAM in COBOL and bit-bang the registers in BASIC. But I don't want to)
#11 What does "generic" refer to? It doesn't get much more generic than void* I may be wrong, but I do believe C code is more portable than C++ by shear number of varied platform support... (embedded applications come to mind) Specific to gaming, is there a C++ compiler for the N64, PSX, PS2, Dreamcast, etc? (I don't know, I've never looked; ...Is there a C compiler?)
P.S. If I get bored I'll look up the exact ticks it takes for a mem->reg & reg->mem transfer... I guessed 4
Edited by - Magmai Kai Holmlor on June 28, 2000 10:57:32 PM
Edited by - Magmai Kai Holmlor on June 29, 2000 1:06:52 AM
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
If you don''t need the "this" pointer, use a static function, which performance-wise is the same as a global function in C, nothing extra pushed on.
If you do need the "this" pointer, then performing the same operation in C would require an explicit "this" parameter pushed on the stack in the same way that C++ does implicitly.
There is no unnecessary overhead here. End of story, done next.
If you do need the "this" pointer, then performing the same operation in C would require an explicit "this" parameter pushed on the stack in the same way that C++ does implicitly.
There is no unnecessary overhead here. End of story, done next.
quote: Original post by gimp
(gimp is currently reading "Efficient C++")
Great book isn''t it?
I''m glad that there are some people like me around that don''t take anyone else''s word for it, and try to figure stuff out by themselves.
Magmai Kai Holmlor, I think your refutations are pretty weak, but then again, that''s perhaps the point you were trying to make - comparing apples to oranges.
And in reference to #11 - Generic probably applies to templates, parametrised types. I personally think THIS is the way forward, and I can''t wait for Visual C++ to support those special template things the ANSI C++ standard allows you to do.
Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~
ERROR: Your beta-version of Life1.0 has expired. Please upgrade to the full version. All important social functions will be disabled from now on.
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
Got to add to this..
Why didn''t anyone mention writing robust code using exceptions in C++ over a multitude of __try/__catch or failure gotos in C?
..
Why didn''t anyone mention writing robust code using exceptions in C++ over a multitude of __try/__catch or failure gotos in C?
..
June 29, 2000 05:53 AM
Let me reiterate:
http://world.std.com/~buzzard/computer/cpp.html
Sean Barrett is the guy who wrote Thief''s renderer, and this article is something I found quite useful, because it presents facts. If you want to attack it, please don''t direct your attacks at either myself (I didn''t write it) or him (he didn''t ask me to post the link). Thanks.
Void: What about structured exception handling?
http://world.std.com/~buzzard/computer/cpp.html
Sean Barrett is the guy who wrote Thief''s renderer, and this article is something I found quite useful, because it presents facts. If you want to attack it, please don''t direct your attacks at either myself (I didn''t write it) or him (he didn''t ask me to post the link). Thanks.
Void: What about structured exception handling?
Quote from that article:
That says it all. Someone who really doesn''t have a clue about C++ bashing it - it''s tempting to everyone who loves programming in C and is used to it. I don''t think you should pay too much attention to that article.
Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~
ERROR: Your beta-version of Life1.0 has expired. Please upgrade to the full version. All important social functions will be disabled from now on.
quote:
(Something like that--I''m not very familiar with C++ operator overloading.)
That says it all. Someone who really doesn''t have a clue about C++ bashing it - it''s tempting to everyone who loves programming in C and is used to it. I don''t think you should pay too much attention to that article.
Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~
ERROR: Your beta-version of Life1.0 has expired. Please upgrade to the full version. All important social functions will be disabled from now on.
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement