SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 22/12/2009, 04:13 AM   #1
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 2,628
Reputation: 136
Default [SOLVED]warning 224: indeterminate array size in "sizeof" expression (symbol "")

Hi all!
I've searched and checked every single topic within the results, but never found a 100% working solution.

This warning is pretty known in this case, but I just wanna know how to fix, if anybody knows...

To the problem...
If you have an array with no cell size (myVar[]) and you try to use sizeof with the array, you will get this warning
Code:
warning 224: indeterminate array size in "sizeof" expression (symbol "")
My "example" is in OnPlayerText, when I try to format the text[] var.
I can't use 128 as len (or so I've heard), and sizeof gives this error.

Any solution?

(Here's the line)
pawn Code:
format( text, sizeof( text ), "Sometext %s", text );
This gives the warning (since the size of 'text' is unknown)

Please help me guys :'P
I really want this to work.

(As I said, I've heard some "rumours" that 128 is "incorrect")

Thanks.
- lrZ^
__________________


NEW: [FS] Simple Cellphones

if( strfind( title, "REP", true ) != -1 )
{________________________________________
Sigh();__________________________
}________________________________________


LarzI is offline  
Old 22/12/2009, 05:26 AM   #2
[HiC]TheKiller
High-roller
 
Join Date: Mar 2008
Location: New Zealand
Posts: 2,630
Reputation: 409
Default Re: warning 224: indeterminate array size in "sizeof" expression (symbol "")

I'm not fully sure, but wouldn't it work like this?

pawn Code:
format(text, strlen(text) + 9, "Sometext %s", text);
strlen gives the length of the text, I'm pretty sure it would work in this case .
__________________
[HiC]TheKiller is offline  
Old 22/12/2009, 05:32 AM   #3
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 2,628
Reputation: 136
Default Re: warning 224: indeterminate array size in "sizeof" expression (symbol "")

Probally.
Never thought about that, lol.
Ty for helping :]
Problem solved (I guess)
__________________


NEW: [FS] Simple Cellphones

if( strfind( title, "REP", true ) != -1 )
{________________________________________
Sigh();__________________________
}________________________________________


LarzI is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pwn Warning 203: symbol is never used: "OnPlayerCommandReceived" Ragidon Help Archive 4 01/04/2010 05:07 PM
Warning 204 : symbol is assigned a value that is never used: "Tuned" cozza123456 Help Archive 9 22/02/2010 05:24 PM
Admin script requires "ReturnUser", "strtok" and "IsNumeric" Rubennnnn Help Archive 1 02/12/2009 07:08 PM
"Bots", "AI", "NPCs"... Computer-controlled pedestrians and traffic! ssflsnoob General 2 23/11/2008 07:06 PM


All times are GMT. The time now is 12:09 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.