On August 19, 2003 04:35 pm, you wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Tuesday 19 August 2003 09:16, Jeffrey Clement wrote:
> > An array would be the usual way to do this.   Makes it way easier to
> > programmatically go through them all and do something to them.
> >
> > C++
> > {
> >     Car cars[30];
> >     for(int i=0; i<30; i++)
> >     {
> >         cars[i] = new Car();
> >     }
> > }
>
> well, personally, in C++ i'd use a vector, a queue, a deque or some other
> list template ... easier/safer to work with due to iterators and simplified
> memory management. attached is a fun bit of code that demonstrates this...
> compile it and try passing various numbers in to it as the first parameter
> (default is 10 if no params passed in)
>

interesting...a little over my head though :) Im not overly concerned about 
memory at the moment, Im just writing some scripts for dynamic HTML, 
basically writing some web apps that will only be useful to me, so Im not 
gonna have 1000 ppl running it at once, and php is good enough to purge all 
the mem it uses when a script completes...AFAIK anyway...

Im gonna play around with your code for interests sake


> using an array is much more C-ish. in C, if i knew exactly how many of that
> data structure i'd need i might use an array ... otherwise i'd make the
> struct a linked list...
>
> > PHP is essentially the same.
>
> PHP is a lot less strict when it comes to array management and doesn't
> really offer anything much better to use, so using an array here isn't such
> a bad idea...
>

actually, after all was said and done I settled for a multi-dimensional array 
over a class, as it was only holding small vars, and didn't need any specific 
functions.

> - --
> Aaron J. Seigo
> GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
>
> iD8DBQE/QqYr1rcusafx20MRAnvSAKCLC6Wr3YkDb9JASIqA51t6mBiG0QCgg7MR
> 8sStPb10MlLyWjrd5pN2YoQ=
> =CBEm
> -----END PGP SIGNATURE-----

-- 
Nick W ([EMAIL PROTECTED])
Registered Linux User #324288 (http://counter.li.org)
MSN Messenger: [EMAIL PROTECTED]
Yahoo: foolish_gambit
ICQ: 303276221
Website: www.fromthecrosstothethrone.com

Reply via email to