Packed String Support
#4

Quote:
Originally Posted by MP2
Посмотреть сообщение
pawn Код:
new pStr[9 char] = !"Hello World";
print(pStr);
SendClientMessageToAll(-1, pStr);
P.S. Not sure why, but it works when the size is only 9 chars, even though the string is 11 chars. Any lower and it produces the error 'initialization data exceeds declared size'. Can someone explain this?
Quote:

in most character sets a character typically takes only a single byte and a cell typicall is a four-byte entity: storing a single character per cell is then a 75% waste. For the sake of compactness, PAWN supports packed strings, where each cell holds as many characters as fit. In our example, one cell would contain four characters, and there is no space wasted.

So shouldn't even 3 cells suffice? (3* 4 == 12 characters < 11 characters of "hello world" ?
Reply


Messages In This Thread
Packed String Support - by MP2 - 27.03.2013, 17:47
Re: Packed String Support - by Vince - 27.03.2013, 18:05
Re: Packed String Support - by MP2 - 30.03.2013, 03:53
Re: Packed String Support - by RajatPawar - 30.03.2013, 08:08

Forum Jump:


Users browsing this thread: 2 Guest(s)