Re: Is this legal?

From: Chris \( Val \) (chrisval_at_bigpond.com.au)
Date: 01/21/04


Date: Thu, 22 Jan 2004 00:09:06 +1100


"Jason" <spacenjasset@yahoo.co.uk> wrote in message
news:buiugd$78f$1@news8.svr.pol.co.uk...
|
| "Jumbo @uko2.co.uk>" <pcr1000011<nospam> wrote in message
| news:1074575154.993441@news.minx.net.uk...
| ...
| > No it's not legal.
| ...
|
| I can see why the other methods aren't legal - particularly having static
| num, since that would mean the object size was undeterminable at compile
| time.
|
| But isn't this legal then, moving the constant outside? Or are we reduced to
| using #DEFINE GRIDDIM 30 (I heard using defines was evil AND unnecessary)
|
| const int griddim = 30;
|
| class grid{
| private:
| int grd[griddim ][griddim ];
| public:
| grid(); ...

Additionally...

If one is to use that approach, then it might be better
to explicitly state that you are using the global variable
'gridnum':

For example:

int grd[ ::griddim ][ ::griddim ];

Note the use of the 'scope resolution operator'.

Cheers.
Chris Val