Re: trouble creating array of objects
From: Greg Comeau (comeau_at_panix.com)
Date: 12/02/03
- Next message: Tristan: "Newbie leaving DOS for Windows and BCC55 to BC++6"
- Previous message: Jumbo: "Re: <ctype.h> toLower()"
- In reply to: Jumbo: "Re: trouble creating array of objects"
- Next in thread: Jumbo: "Re: trouble creating array of objects"
- Reply: Jumbo: "Re: trouble creating array of objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 2 Dec 2003 15:01:08 -0500
In article <1070368078.78862@news.minx.net.uk>,
Jumbo <pcrcutitout1000011@uko2.co.uk> wrote:
>Vectors are not a replacement for arrays.
>1 reason he might not want to use vectors is perhaps because he isn't ready
>to start using vectors.
>Another reason is perhaps because he doesn't understand templates therefore
>he doesn't understand how the vector class works..
>Another reason might be the overheads incurred.
>Or perhaps he is simply learning about Arrays.
>There are lots of reasons not to use vectors.
>
>And the major reason here is that you should not be using advanced templated
>classes if you don't even know how to create a 2d array dynamically.
>
>I am getting used to seeing this reply to array questions and your lack
>understanding of the difference between arrays and vectors but it fails to
>surprise me anymore.
>
>So I shun your advice and tell the chap to continue learning about arrays
>until he is ready to start using the standard template library.
It's so that there may be reasons for one or the other.
However, there being a newbie isn't necessarily one of them.
Yes, there is a learning curve to telling newbie's to
#include this or and and also to use <>'s with a type.
However, using the built-in array has learning curve
costs associated with it too. So they both have many
cons.
That said, I prefer newbie to learn the lib version first
because they are more first class citizens in many cases
than the builtin types are. This brings along with it
that issues like providing type safety and being able
to sidestep common errors can be postpone, and also that
folks can get to the conceptual issues and actually producing
something, rather than fighting syntax and such.
So in short, telling somebody to use std::vector<int> is
hardly any more "advanced" than telling them to use int X[??],
and has been shown that folks can immediately be able to begin
using the basics of the C++ Standard Library. IOWs, they
can be immediately ready to use the parts of it which make
sense for a beginner to use.
-- Greg Comeau/4.3.3:Full C++03 core language + more Windows backends Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
- Next message: Tristan: "Newbie leaving DOS for Windows and BCC55 to BC++6"
- Previous message: Jumbo: "Re: <ctype.h> toLower()"
- In reply to: Jumbo: "Re: trouble creating array of objects"
- Next in thread: Jumbo: "Re: trouble creating array of objects"
- Reply: Jumbo: "Re: trouble creating array of objects"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|