POV-Ray : Newsgroups : povray.off-topic : Question to the programers here : Re: Question to the programers here Server Time
29 Jul 2024 16:31:57 EDT (-0400)
  Re: Question to the programers here  
From: Warp
Date: 30 Jul 2011 15:23:49
Message: <4e345a45@news.povray.org>
stbenge <"egnebts <-inverted"@hotmail.com> wrote:
> The basics of C++ aren't so hard to learn, and it's nice to know 
> exactly_what_data_types you are using. The code is much cleaner than any 
> BASIC. Just make sure you free up any memory you allocate, as you don't 
> need leaks.

  You can get pretty far without ever writing a single 'new' (or 'malloc').
And if you never write a single 'new', you never have to write a single
'delete' either.

  One of the major problems with people who start learning C++ for the
first time is that in many cases they come from either a C or a Java (or
similar) background, both of which have explicit dynamic allocation as a
central concept. People who have that kind of background often have a hard
time "unlearning" that. Hence the C++ code made by these people will be rife
with unneeded dynamic allocations (which make the whole program needlessly
complex and unsafe).

  (Of course using 'new' is not the only way to easily screw up memory
management by mistake. If you start using pointers, or even iterators,
chances are that you are going make a mistake sooner or later. C++ is a
bit complicated like that.)

  It can be difficult to teach/learn C++ in a way that the safe practices
are learnt first.

> With C's vector class, you can create easily-manipulated dynamic arrays. 

  Don't you mean C++'s?

-- 
                                                          - Warp


Post a reply to this message

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