• Advertisement
Sign in to follow this  

Is c++ good

This topic is 1314 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone,

About a week ago i started learning the basics of c++. 

I know it's a long hard way, but my ultimate goal is to make games.

For fun i just looked to the classifieds page and there i saw that most people,

who need a programmer. Need one who knows c#. My question is: is c++

still so good for game programming?

Thanks.

 

Share this post


Link to post
Share on other sites
Advertisement

As I said in another thread, C++ is IMHO a language every programmer should know but almost none should use. Learning it will teach you a great deal about the lower levels, but it's incredibly annoying and unproductive to use, mostly for historical reasons. C# (and many other languages) got a fresh start in the modern days and is much easier to use. Programming is hard enough as it is.

Share this post


Link to post
Share on other sites

Choose the language you're most comfortable with - you'll get a lot more done in a given amount of time. Personally, I prefer a hybrid between C & C++ (often called C with objects). I find it easy to write clear code, which largely self documents, and I find it aesthetically pleasing. This is obviously totally subjective.

 

Some people will tell you that C/C++ will offer better performance, but the truth is that well thought out and efficient algorithms gain far more performance (in any language) than micro optimisations performed at the last minute.

Share this post


Link to post
Share on other sites

I agree with most of the comments here. C/C++ are great to learn to use but they are fazing out in a lot of more common areas.  They still have their place and will probably have their place for a very long time yet to come.  Learning will make you a better programmer overall even in more modern languages.  For games you really do not need C++ or C.  There are lots of great technologies out there today that are beyond capable of keeping up.  Heck even today much of the games you play are done with scripting languages and those languages hook into the C++ rendering engine on the backend.

 

The main reason I say C/C++ will be for around for a long time is mainly because of specific areas like kernel development as well as embedded micro controller development.  Sure there are new languages coming out that are compiled to machine code like Google's Go.  The big downfall of those types of languages is the lack of direct memory access through pointers and direct interfacing with assembly code.  In the world of Kernels and embedded micro controller (think ARM Cortex M, PIC, AVR) you really need that otherwise you can't really do anything without extreme C interfacing hoops.  Some of those chips are so tiny in memory you would be lucky to get a runtime driven language on them.  These are extreme cases.

 

So in the end if you are learning your first language I would recommend it not be C++.  I would rather see a new programmer on their first language use pure C, C#, Java, or Python.  C is a very simple language to learn and will let you learn some really useful concepts this is still my all time favorite language.  C#, Java, and Python are also relatively simple languages that rule out memory management and will allow you to focus on core algorithm concepts.  Choose something you want to choose not what everyone forces you to choose and stick with it for a while before moving on.  Every language you learn will teach you something new.

Share this post


Link to post
Share on other sites

C++ is basically the latin of programming languages.  Its usage (outside of games) is getting smaller and smaller but, it is the go to language that a lot of companies still use for programming tests (even for PHP or Java programming jobs).

It is a powerful language but it is also a language that is full of pitfalls and gotchas.  It is still used by most AAA companies along with some kind of scipting language but for an indie game like the ones that are advertised in the classifieds they are constrained by small team sizes, finances and time so they will tend to use established games engines that will use a higher level language.

 

 

 


understand C++ can transition to most other languages (expect functional)

 

 

Functional programming is just a paradigm and C++11 supports programming in a functional style so why you assume somebody who fully understands C++ would have trouble I don't know.

 

 

 

 


But it doesn't work the other way. Take someone who knows C#, or Java, or Javascript, and show them some C++ code. They will not understand it.

 

Theres no reason why somebody who has used any of these languages would not understand C++ code.

Edited by Buster2000

Share this post


Link to post
Share on other sites

I think that it is all alike.

 

The biggest problem for someone who is new to any of the cited languages is the object oriented design. So the focus should be on the question how can you learn that. With the knowledge of OOD the languages all are quiet easy to use.

Share this post


Link to post
Share on other sites

C++ is still the lingua franca of the AAA space in gamedev, and it's still very popular in smaller-budget / indie titles (except on the web browser), but it's been somewhat displaced by things like Unity (which is probably like 80% of the C# game developers).
 


C++ is basically the latin of programming languages. Its usage (outside of games) is getting smaller and smaller but, it is the go to language that a lot of companies still use for programming tests (even for PHP or Java programming jobs).

 

I don't think I've ever been asked a C++ question or asked to write any C++ code for a job that didn't involve C++.  Usually it's "X language from the job listing" or "whatever you want".

 


Functional programming is just a paradigm and C++11 supports programming in a functional style so why you assume somebody who fully understands C++ would have trouble I don't know.

 

This is a bit un-topical, but C++'s "functional style" doesn't really prepare you all-too-well for full-blown functional programming.  Great, you know how map, filter, and reduce work.  You're not going to pick up more fundamental things like Lazy evaluation, continuations, or monads.

 


Theres no reason why somebody who has used any of these languages would not understand C++ code.

 

This I have to disagree with vehemently.  Many of the similarities between C++ and Java/C# (Javascript is a totally different beast) are superficial.  Templates are far more powerful, expressive, and hard to figure out than the comparatively simple generics in the aforementioned language.  What the hell is a foo<1>?  What do you think a java programmer without any experience will do when he sees this?  The reference semantics are different too.  It's easy to see "std::vector v;" and say "oh, that must be how C++ programmers use new."  In most cases, it is.  Then they try to return it by reference, and the world breaks.  This is assuming you haven't tried to screw with their head by throwing pointers at them.

Share this post


Link to post
Share on other sites

If I have switch from one language to another I do not try to read something right from the start. It must fail if it goes over the simple control statements and assignements.

I try to make simple programs like the hello world to ask the question "in C++ it is called x and done this way. How is it done in java, C# or any other language".

Share this post


Link to post
Share on other sites

I learned a few languages before picking up C++ many years ago, but I noticed that after I learned C++, all other languages were much easier to pick up since a lot of concepts in C++ were easy to carry over to other languages.  

Share this post


Link to post
Share on other sites

Theres no reason why somebody who has used any of these languages would not understand C++ code.

I dont know... C++ has an automatic memory management system (RAII) that is quite different from other languages (especially ones needing a GC). Even though developers new to C++ may be able to understand what the C++ code does, I don't know if I would trust that their code is safe and correct.

 

But I could be wrong. Apple has proven that if you make a language trendy and cool enough (Objective-C), no matter how low level and complex it is*, even beginner developers are very capable and productive regardless. Better still, many beginner developers are quite happily cross compiling to restrictive ARM devices and remote debugging. Something that is quite a step up from what I was doing when I was starting out (VB6) ;)

 

* no garbage collector (Apple deprecated it), pointers, possible undefined functionality, exposure to C-style memory management.

Edited by Karsten_

Share this post


Link to post
Share on other sites


Buster2000, on 15 Jul 2014 - 08:29 AM, said:

Theres no reason why somebody who has used any of these languages would not understand C++ code.

I dont know... C++ has an automatic memory management system (RAII) that is quite different from other languages (especially ones needing a GC). Even though developers new to C++ may be able to understand what the C++ code does, I don't know if I would trust that their code is safe and correct.

 

I think an experienced coder who has used any language should be able to read the code from almost any other language and be able to fatham what the code is doing.   The finer perculiarities of the language syntax maybe not but it shouldn't be too difficult for them to figure out.  I am of course talking about an experienced coder and not somebody who has spent a few months learning a little C# and now calls themselves an expert.

 


Buster2000, on 15 Jul 2014 - 08:29 AM, said:


C++ is basically the latin of programming languages. Its usage (outside of games) is getting smaller and smaller but, it is the go to language that a lot of companies still use for programming tests (even for PHP or Java programming jobs).



I don't think I've ever been asked a C++ question or asked to write any C++ code for a job that didn't involve C++. Usually it's "X language from the job listing" or "whatever you want".

 

I have by several companies including Microsoft, Facebook and Yahoo.  Also outside of the games industry I haven't seen many jobs that say you must know X language.  Once you get to a senior position they pretty much all say you must be a full stack developer who can handle any language that we throw at you.

Share this post


Link to post
Share on other sites

material you'll find for it are for the older version. All the old stuff still works (C++ is very big on maintaining backwards compatibility, which is a source of most of its warts and ugliness) 

 

Imagine what it would be if c++ would not hold the backward compatibility ;/

Then you will have 

1) two wersions of c++ in the run (which would will make some to revrite millions of lines probably etc)

2) as the previous c++ would be marked obsolete it would effect in the thing called 'code rot' imo both versions of c++ older and younger will be suffering on this

 

This is even now present by publicing the changes and staying backward compatible - but if it would drop backward compatibility it would raise much more

 

(for some case it is fun/silly of standarization comitee to produce different versions of language, the standarization was born exactly to deny the multiplity of close but not compatible versions and problems and space poluttion 

that it makes - then standarization comietee was starting 

to make those uncompatible verions theyselves ;/ this is

a bit sick) - the one thing that helps with this kind of problems is backward compatibility as you may still use core language (i mean older version and its still alive

 

same think i dislike the rotting proces of opengl (first ogl version was sentenced rotten to the bone, then we have 

the second about wich i cannot be sure will not rot as well

- this makes me feeling a bit disrespectfull to that as i could

respect more some real stable environment and system for decades

Edited by fir

Share this post


Link to post
Share on other sites

One thing I find "difficult" dealing with C++ is that it is a big big monster with different heads. You say "C++" but which one? Every C++ codebase I have come across uses a different subset of the language, completely different coding styles and guidelines.. and the more they add to the language the more this become evident.

More modern languages seem to have a better appreciation about coding standards and the importance to promote a clear style that identifies a language. Java comes with a style both "visually" (where the braces go, how you name things, which case you use) and logically.. with the standard library promoting that style. C# is even more on the same line.. Go is forcing the idea of "the one true way to Go". I have been writing C++ for almost 20 years.. I look at Unreal Engine 4 and my eyes hurt... it;s not nice and it wouldn't happen in a more modern language.

Share this post


Link to post
Share on other sites
Yeah throughout a career, you'll learn many different styles of C++, some of which are almost as different from each other as C is to C#! ;)

Regarding interview tests, I've usually seen C used for that (even for Lua jobs) to see if someone understands their fundamentals well.

Share this post


Link to post
Share on other sites

it;s not nice and it wouldn't happen in a more modern language.

Interestingly now that C# is starting to age, I am starting to notice some of the same complexities as in C++.

 

For example, the C# that you would need to write in Metro applications is very different to what you would write in Unity. It has a much more non-blocking / "javascript" like approach where much of the functionality is implemented as async functions (albeit all completely unique to Metro and very unportable so we can't really blame C# here). Much of the standard C# patterns do not work here (in particular the using (or IDisposable, try / finally) pattern for memory management since allocations need to persist across functions).

 

Perhaps the biggest issue is that a lot (too much) of the standard C# library has been removed or replaced in Metro (.NET 4.0 Core) and it is a little harder to work around than in C++ because of a less flexible preprocessor.

 

That said the Metro C++(/cx) is pretty crazy too and sees many of the same issues as C# with the stripping down of the <windows.h>, however it's standard libraries are completely intact allowing for IMO an easier porting process.

 

So I guess it comes down to the fact that Metro is annoying, however, since C++ has a smaller standard library than C# it means there is less there for Microsoft to shred! ;)

 

I wouldn't be surprised if a future version of C# does provide a preprocessor similar to C++. Once C# gets the same amount of legacy baggage as C++ (and since it is a popular language this is quite likely) then it really is going to need it.

Edited by Karsten_

Share this post


Link to post
Share on other sites


Regarding interview tests, I've usually seen C used for that (even for Lua jobs) to see if someone understands their fundamentals well.

 

Honestly, when asking interview questions I usually don't care what language the person uses to solve the problems posed, just as long as they can solve them. There are some occasions where we'll specify what language should be used to solve a particular problem, but that's actually pretty infrequent. I can understand it being more common in game development though.

Share this post


Link to post
Share on other sites

Not sure. It's hard I can tell you that much. I think c++ is a standard. Away it's my first language and I haven't studied anything else except html.  

 

 

 

Note: global variables are awesome. Learn to love them.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement