POV-Ray : Newsgroups : povray.off-topic : Games programmers : Re: Games programmers Server Time
10 Oct 2024 11:18:51 EDT (-0400)
  Re: Games programmers  
From: Warp
Date: 11 Sep 2008 12:24:33
Message: <48c94641@news.povray.org>
Invisible <voi### [at] devnull> wrote:
>  From what I've read, C++ is exactly like C, but 80% more complicated. 

  Incorrect. C++ support most of the things as C, but is approximately 80%
less complicated to use.

  For example, handling dynamic data in C++ is usually laughably easy and
safe, while in C it's a nightmare.

> Given that I could bearly produce working code in C with the tutor's 
> help, my chances of getting anywhere with C++ are basically nil.

  On the contrary: C++ makes it much easier to write working safe code.
You just need a few rules of thumb:

1) If you ever get the temptation of using the keyword 'new', don't.
   (And no, "malloc()" is not good either. See rule 3.)

2) If possible, avoid using pointers.

3) If possible, avoid functions in the C standard library.

4) If you want, use the at() method to access data in random access data
   containers.

  That's it. With these simple rules you will be writing clean safe code
in no time. These rules should be broken only when you get very fluent
with the language and know what you are doing.

> > I 
> > had a lot of fun with C++ and OpenGL in college. It's really not that hard 
> > to learn for someone like you.

> As I say, the trouble is that if your program doesn't work, there is no 
> way you can ever find out why.

  Modern compilers and profilers do a quite good job at catching typical
beginner mistakes in C++ programs.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.