[SOLVED]warning 224: indeterminate array size in "sizeof" expression (symbol "")
#1

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^
Reply
#2

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 .
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)