• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Zyndrof

What makes C++ so powerful?

148 posts in this topic

Quote:
Original post by CTar
Quote:
Original post by Kaze
games seem to not lend themselves well to most "good" oop practices and i usually end up with messy unmodular code that could have been done with much less code in a more flexible environment.

That's most likely your fault, OOP is perfectly capable of describing a game. Also what do you mean, when you say a "more flexible envirornment"? A procedural language like C or C++?

1 mostly that games inherintly have high coupling as you needs most of the main game elements to interact with each other, note that im not saying it cant be done, im just saying it dosent give a lot of benifit and usally requires more code and presents more organization problems
2 yes c++ but i also find .net to be a nice balance of flexibility and organized object driven design


0

Share this post


Link to post
Share on other sites
Fixed. It doesn't take #'s for some reason, i blame the dart:
0

Share this post


Link to post
Share on other sites
No, it was some wierdness with the forum software parsing - and subsequently mangling - links that have in-page anchors (ie, "URL#anchor") where the URL ends in an ampersand. Fixed by using good old &.
0

Share this post


Link to post
Share on other sites
Your fix failed! You are firod!

C++ is a very hard language to master, even members of the standards body make mistakes with regards to the language from time to time.
0

Share this post


Link to post
Share on other sites
Quote:
Just give'em a header from one of boost libraries that generates code from a mix of macro & template metaprogramming and they lay a brick in their paints....


snipped for brevity

#ifndef BOOST_ASSIGN_MAX_PARAMS // use user's value
#define BOOST_ASSIGN_MAX_PARAMS 5
#endif
#define BOOST_ASSIGN_MAX_PARAMETERS (BOOST_ASSIGN_MAX_PARAMS - 1)
#define BOOST_ASSIGN_PARAMS1(n) BOOST_PP_ENUM_PARAMS(n, class U)
#define BOOST_ASSIGN_PARAMS2(n) BOOST_PP_ENUM_BINARY_PARAMS(n, U, const& u)
#define BOOST_ASSIGN_PARAMS3(n) BOOST_PP_ENUM_PARAMS(n, u)

#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS)
#define BOOST_PP_LOCAL_MACRO(n) template< class U, BOOST_ASSIGN_PARAMS1(n) > generic_ptr_list& operator()(U const& u, BOOST_ASSIGN_PARAMS2(n) ) { this->push_back( new T(u, BOOST_ASSIGN_PARAMS3(n))); return *this; } /**/

#include BOOST_PP_LOCAL_ITERATE()

}; // class 'generic_ptr_list'

} // namespace 'assign_detail'

namespace assign
{
template< class T >
inline assign_detail::generic_ptr_list<T>
ptr_list_of()
{
return assign_detail::generic_ptr_list<T>()();
}

template< class T, class U >
inline assign_detail::generic_ptr_list<T>
ptr_list_of( const U& t )
{
return assign_detail::generic_ptr_list<T>()( t );
}


#define BOOST_PP_LOCAL_LIMITS (1, BOOST_ASSIGN_MAX_PARAMETERS)
#define BOOST_PP_LOCAL_MACRO(n) template< class T, class U, BOOST_ASSIGN_PARAMS1(n) > inline assign_detail::generic_ptr_list<T> ptr_list_of(U const& u, BOOST_ASSIGN_PARAMS2(n) ) { return assign_detail::generic_ptr_list<T>()(u, BOOST_ASSIGN_PARAMS3(n)); } /**/

#include BOOST_PP_LOCAL_ITERATE()

0

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Quote:
Original post by Anonymous Poster
What about changing variables in hand directly from memory?
What a terrible thing to do. A Java programmer does not think in terms of memory addresses ;)

What about making visual effect by changing memory. Some tricks known well from many years.


Java primitives are in fact something like virtual registers, and arrays are an abstraction of direct memory access. So expericenced programmer is able to think in terms of CPU registers, if he want, without worrying about any manual register allocation.

While Java prgrammer (not scrip kiddies) could do index arithmetic on array, in most situation they are using OpenGL, because of simplicity.


//
C++ like operator overloading decreases source code predictability. Imagine situation when you can see.
vector3D a = new vector3D(3D, 5D, 3D);
c = a * b;

And now tell me what is "c"? And what is the result of a * b?
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Raghar
C++ like operator overloading decreases source code predictability. Imagine situation when you can see.
vector3D a = new vector3D(3D, 5D, 3D);
c = a * b;

And now tell me what is "c"? And what is the result of a * b?
The way I see it, the fundamental difference is as such. C++ functions under the (often incorrect) assumption that the programmer is competent. In contrast, Java assumes (sometimes correctly) the programmer is a dumbass who will make every mistake he can possibly make, turning his code base into a mess. As a result, C++ gives you all sorts of powerful tools, some very dangerous. Java takes away anything which the Java designers perceived as having any potential for abuse.

It's probably clear which side I favor.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Talroth
Quote:
Original post by nmi
And you should remember that Java also needed a second start (the first version was called 'Oak' if I remember correctly).

I'm fairly sure I read somewhere that Java was first called OAK, but changed to java due to copyright issues, (there was already a project oak) and the last version of Oak was the same as the first version of Java. I can look it up to be sure if someone cares.


Java is to OAK as Wii is to Revolution. Name OAK was used by different programming language so they decided to release it under another name. (It would be confusing if there would be two different languages with the same name. In fact even name javascript was confusing.)

BTW language specification is here.

http://java.sun.com/docs/books/jls/
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
The way I see it, the fundamental difference is as such. C++ functions under the (often incorrect) assumption that the programmer is competent. In contrast, Java assumes (sometimes correctly) the programmer is a dumbass who will make every mistake he can possibly make, turning his code base into a mess. As a result, C++ gives you all sorts of powerful tools, some very dangerous. Java takes away anything which the Java designers perceived as having any potential for abuse.
It's probably clear which side I favor.


Cute. ^_^

I'm using programming language as I want, not as it is expected to be used. However when you are talking about powerful tools, what happened to multipass compiler, short compile times, multiple entry points into program, type sizes preciselly defined in the standard, and SHR? To be forced into creating both 32 bit and 64 bit executable isn't nice either.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Raghar
C++ like operator overloading decreases source code predictability. Imagine situation when you can see.
vector3D a = new vector3D(3D, 5D, 3D);
c = a * b;

And now tell me what is "c"? And what is the result of a * b?
That's not really fair. Bad code can be written in any language.

vector3D a = new vector3d(3D, 5D, 3D);
c = a.Multiply(b);

Is that any clearer? Of course not. I'd assume b is either another 3d vector or a matrix of the correct dimensions. C could be the cross product. Maybe the dot product. Maybe b is a magnitude, and c is the scaled vector. Maybe the result of a matrix transformation. Regardless, poorly written code is poorly written code.

How about:

Vector3d unitVec = new Vector3d(x,y,z);
scaledVec = unitVec * scale.

The source code is only as readable as the programmer is willing to make it.
0

Share this post


Link to post
Share on other sites
well I can't recall reading through these 6 pages of replies and seeing the answer, so I'll put it here:

The Programmer!
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Raghar
I'm using programming language as I want, not as it is expected to be used. However when you are talking about powerful tools, what happened to multipass compiler, short compile times, multiple entry points into program, type sizes preciselly defined in the standard, and SHR? To be forced into creating both 32 bit and 64 bit executable isn't nice either.
And I moved to C# for my hobby work for the exact same reasons. Java did a lot of good things, but I feel like Java made a vast number of mistakes at the same time, and those mistakes are a point of considerable irritation for me when I have to work in Java.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Oberon_Command
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...


C# operating system
http://channel9.msdn.com/ShowPost.aspx?PostID=68302
A programming language can be used to do anything. To acknowledge a languages weaknesses is logical, but to say that it can't out right perform a task that all programming languages can do is foolish for it limits ones own creativity and sets a box on what can and cannot be done.


all programming languages have their strengths and their weaknesses.
The skill of the programmer can be used to overcome those weaknesses but when in a situation where the weakness of the programming language is too apparent than use another one.

C++ is a balanced language and can be considered the best simply because of the legacy it is build. No other programming language is as documented, as source happy, and as analyzed as it.

The fact of the matter is that it is the most widely used language out there, and it's one of the oldest. There is power in numbers. There is power in knowledge. Because of how programming works the most popular language becomes
The most powerful language.

C++ is the most popular language, thus it is the most powerful.

0

Share this post


Link to post
Share on other sites
Quote:
Original post by JustOwninDaFINALBOSS
C++ is the most popular language, thus it is the most powerful.


Popularity is a pathetic heuristic to determine whether a programming language is any good/powerful/elegant/etc/etc. Java being a prime example of it (time to put on the old flame, bullet, and bomb proof vest).

[Edited by - snk_kid on May 15, 2006 7:05:01 AM]
0

Share this post


Link to post
Share on other sites
Somebody mentioned operator overloading, there is nothing wrong with it infact it can be one of the vital ingredients for the recipe of domain-specific embedded language (DSEL). The problem with C++'s operator overloading model is it's quite limited and functions are not first class so one must resort to hackery and expression templates to achieve DSEL combinator libraries in C++.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Cold_Steel
Quote:
Original post by Raghar
C++ like operator overloading decreases source code predictability. Imagine situation when you can see.
vector3D a = new vector3D(3D, 5D, 3D);
c = a * b;

And now tell me what is "c"? And what is the result of a * b?
That's not really fair. Bad code can be written in any language.

vector3D a = new vector3d(3D, 5D, 3D);
c = a.Multiply(b);

Is that any clearer? Of course not. I'd assume b is either another 3d vector or a matrix of the correct dimensions. C could be the cross product. Maybe the dot product. Maybe b is a magnitude, and c is the scaled vector. Maybe the result of a matrix transformation. Regardless, poorly written code is poorly written code.

How about:

Vector3d unitVec = new Vector3d(x,y,z);
scaledVec = unitVec * scale.

The source code is only as readable as the programmer is willing to make it.


fully agreed. code is as readable as you make it.

personally, i would like a language where defining functions is much more flexible: you should be able to give it any name, be it "+" or whatever, and you should be able to specify if it only takes arguments on its right hand side, or that it accepts arguments from both sides, or is used as an unary operator.

something like function := [arglist] = [arglist] "functionname" [arglist].

i believe python does something like that?
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Eelco
personally, i would like a language where defining functions is much more flexible: you should be able to give it any name, be it "+" or whatever, and you should be able to specify if it only takes arguments on its right hand side, or that it accepts arguments from both sides, or is used as an unary operator.

something like function := [arglist] = [arglist] "functionname" [arglist].

i believe python does something like that?


In haskell one can overload virtually any symbol with any number together (like +++ for instance) one can state the artery, associativity and precedence levels. Named functions can be made infix using quasi-quotes i.e 1 `plus` 2 is the same as plus 1 2, operators can be sectioned, all functions (including operators) are first-class so they can be passed/returned/stored. These are the reasons why haskell is so good for writing domain specific embedded languages (DSELs).
0

Share this post


Link to post
Share on other sites
Quote:
Original post by JustOwninDaFINALBOSS
A programming language can be used to do anything.

No, not if it doesn't have support for it. For example C# 2.0 doesn't have much support for systems programming, and no Singularity (the OS you talked about) is not coded in C#, it's coded in Sing#, which is a superset of the Spec#, which is an extension of C#. Also 2 % of the kernel is written in asm and 3 % is written in C++. The system used by Sing# is called Bartok.

Quote:
C++ is a balanced language and can be considered the best simply because of the legacy it is build. No other programming language is as documented, as source happy, and as analyzed as it.

Does this make C++ a good language? No, legacy is a reason to why one might choose C++, it doesn't make the language itself more powerful.

Quote:
The fact of the matter is that it is the most widely used language out there, and it's one of the oldest. There is power in numbers. There is power in knowledge. Because of how programming works the most popular language becomes
The most powerful language.

Yes, because your program suddenly gets much better when 10000 other programmers starts to program in the same language.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by snk_kid
Popularity is a pathetic heuristic to determine whether a programming language is any good/powerful/elegant/etc/etc. Java being a prime example of it (time to put on the old flame, bullet, and bomb proof vest).

Popularity is a pathetic heuristic to determine whether anything is good/powerful/elegant/etc/etc. Just turn on FM radio or pick up one of the romantic novels from the bestsellers section.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by CTar
Does this make C++ a good language? No, legacy is a reason to why one might choose C++, it doesn't make the language itself more powerful.

There is certainly some value in popularity. Ability to hire reasonably proficient programmers for less than astronomic salaries. Large body of available libraries and documentation. Ability to get some support from public forums.

I'm playing a devil's advocate. I'd hire four Lisp programmers rather than ten Java programmers for the same total price any day.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by CTar
Quote:
Original post by JustOwninDaFINALBOSS
A programming language can be used to do anything.

No, not if it doesn't have support for it. For example C# 2.0 doesn't have much support for systems programming, and no Singularity (the OS you talked about) is not coded in C#, it's coded in Sing#, which is a superset of the Spec#, which is an extension of C#. Also 2 % of the kernel is written in asm and 3 % is written in C++. The system used by Sing# is called Bartok.

Quote:
C++ is a balanced language and can be considered the best simply because of the legacy it is build. No other programming language is as documented, as source happy, and as analyzed as it.

Does this make C++ a good language? No, legacy is a reason to why one might choose C++, it doesn't make the language itself more powerful.

Quote:
The fact of the matter is that it is the most widely used language out there, and it's one of the oldest. There is power in numbers. There is power in knowledge. Because of how programming works the most popular language becomes
The most powerful language.

Yes, because your program suddenly gets much better when 10000 other programmers starts to program in the same language.



No the langueage itself does not get better. But the language as a tool gets better. Much better.

C++ is not in itself a superior language - actually some may consider it a horrible language considering all its bagage. But the fact that it's so widely used, documented, and so many third-party components exist for use with C++, makes C++ as a tool vastly better than it would've been without all those accesories.

So in a way C++ does improve (as a tool) simply on the account of the number of people using it.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by CoffeeMug
There is certainly some value in popularity. Ability to hire reasonably proficient programmers for less than astronomic salaries. Large body of available libraries and documentation. Ability to get some support from public forums.

Yes, good reasons to choose the language, but the language won't get any better because of it. The person I was quoting said that C++ could be considered the best simply because of legacy.

rohde: I agree
0

Share this post


Link to post
Share on other sites
Quote:
Original post by rohde
So in a way C++ does improve (as a tool) simply on the account of the number of people using it.

The question is whether availability of cheap developers, documentation, and a huge number of libraries outweighs the baggage. Many people claim that it does not (add me to that list).
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0