PDA

View Full Version : Problem with defining.


Typhome
11/01/2012, 04:58 PM
I have one define that's: #define AUTOLIIMIT 100
And variable: new autosysteem;

I've tried that: new CarInfo[AUTOLIIMIT+autosysteem][cInfo];

But it will show errors and warnings.

Any idea how fix that problem? Thanks!

Error & Warning
error 008: must be a constant expression; assumed zero
warning 224: indeterminate array size in "sizeof" expression (symbol "")
warning 224: indeterminate array size in "sizeof" expression (symbol "")
warning 224: indeterminate array size in "sizeof" expression (symbol "")
warning 224: indeterminate array size in "sizeof" expression (symbol "")
warning 224: indeterminate array size in "sizeof" expression (symbol "")
warning 224: indeterminate array size in "sizeof" expression (symbol "")
warning 224: indeterminate array size in "sizeof" expression (symbol "")
warning 224: indeterminate array size in "sizeof" expression (symbol "")
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

Psymetrix
11/01/2012, 05:58 PM
You can't do it like that. I just posted this but it explains exactly why you can't.
http://forum.sa-mp.com/showthread.php?t=166680&highlight=pawn-lang.pdf

new CarInfo[AUTOLIIMIT][cInfo];

Typhome
11/01/2012, 06:14 PM
Then how do it.. :/ I need add too "autosysteem" value (to AUTOLIIMIT for CarInfo)

Psymetrix
11/01/2012, 06:26 PM
If your saving information about each vehicle, new CarInfo[MAX_VEHICLES][cInfo]; Is enough to record information about every vehicle since the limit is 2000.

Array sizes cannot be changed dynamically by using a variable as the size since they are handled by the Pre-Processor.