

Introduction to C++ with Game Development - octopus
http://www.devmaster.net/articles/intro-to-c++-with-game-dev/part1.php

======
Ives
The example on the bottom can hardly be called C++

    
    
      #include "stdio.h"
      
      void main()
      {
      	printf( "Hello world!\n" );
      	getchar();
      }
    

\- main() should return int, not void

\- std::cout should be used instead of printf

\- std::cin should be used instead of getchar()

~~~
SamReidHughes
\- Who cares

\- No

\- No

And you didn't even complain about "stdio.h".

~~~
dkersten
If you call it C++, then you should care.

~~~
SamReidHughes
Not really. People who feel the need to point out a use of void main every
time they see it have nothing important to talk about.

~~~
msbarnett
On the other hand, people who write void main clearly have nothing to teach
about C++, because that plainly _isn't C++_.

~~~
SamReidHughes
Apparently they do, because they're teaching it. But I guess you don't care
about that, it's more important that you inform everybody about this
distinction whereby you have a definition of C++ that requires more rigorous
adherence to one of the standards, because it's very important that people be
informed of this. We wouldn't want beginners to write programs that use "void
main" and work perfectly fine. For that would be bad. No, this tutorial should
be retitled. It should be retitled to "Game Programming with a language that's
not exactly C++ but is acceptable to Microsoft's C++ compiler." Because that's
a correct title. It would have been a perfectly fine tutorial that would
introduce students to C++ programming, but right now it's horrible.

I was so glad to learn that people here are aware that C++ says main should
return int. Because I was sitting here, wondering if somebody on Hacker News
knows that main should return int. And then Ives came along to say, "I do!"
That resolved my question. But then as a special treat, somebody else came
along to point out that the iostreams library is not part of the STL. Or is
it? I sure wouldn't want to forget the distinction between The SL and The STL.
For they are different things. I think.

Confession time: One time, I learned that I had once learned some C++ from a
tutorial that had used "void main." I felt doomed. I had just gotten over the
phase where I thought it was okay not to correct somebody when not every part
of every clause of every sentence they said was correct. But then I found that
I liked using void main. And then before you knew it, I started writing
<stdlib.h> instead of <cstdlib>, and then I used C99 header files, and then I
used variable length arrays, and I used vector::data, and I liked it. The next
thing you know I found myself running two threads at the same time, wouldn't
you believe it? Now I know that what I was using was not C++, but that what I
used was an abomination.

------
eropple
Learning to program C++ via game development strikes me as remarkably akin to
learning to maintain a car by starting on a Ferrari. (Well, aside from the
notion that a Ferrari is enjoyable to drive, anyway.)

C++ is tricky enough. Game development introduces additional layers of
ugliness and complexity that I think can distract from actually learning to
write good, secure, safe C++.

~~~
nasmorn
On the other hand it is one of the fields where the use of C++ is completly
warranted. It is fun and offers challenging problems. I started programming
like that and I sure liked it.

~~~
eropple
Completely warranted? If you're doing very-high-end stuff, yes. For the
majority of indie-esque games and the stuff you'll be capable of doing when
learning to program, and learning to write sane code during your formative
stages? Not so much.

C# with OpenTK (or SlimDX, or XNA) or Python with PyGame are both superior
choices for that sort of thing.

~~~
Impossible
To be fair not everyone is making indie games. Although I wouldn't suggest
starting out with C++, and wouldn't suggest it to people wanting to make games
for PC as a single developer in a small team, if you eventually want to be a
programmer working on AAA PC, console or mobile games you have to know C++
well in order to get hired, even if you primarily work in a different
language. C++ is also still required for higher end indie stuff. I don't see
that changing any time soon.

~~~
eropple
If they're not making indie games, or are making "higher end indie stuff,"
they wouldn't be reading an article like this.

~~~
Impossible
Eh not necessarily. Someone in high school or college could be reading this
article because they want to work on AAA games in the future and need a decent
starting point, not because they want to start making indie games right now.
You have to learn somehow and the game industry still hires junior
programmers.

