Pawn compiler crashing
#4

I meant bracket pointing wrong way! Brackets are the most important thing for the compiler, they determine scope - when you miss one, or do things like that compiler can't handle things. As for checking is there is no text, check out isnull macro:

pawn Код:
#define isnull(%1) \
        ((%1[0] == 0) || (%1[0] == 1 && %1[1] == 0))
As you might know, string is an array of chars + NUL. So "ABC" is in fact { 'A', 'B', 'C', 0 } (0, '\0' and EOS are equivalent in pawn). isnull checks if first character is 0 - meaning end of string. The other comparison is important, but it affects other things. So - to check if string is empty:
pawn Код:
if(yourstring[0] == 0)
//equivalent to
if(yourstring[0] == '\0')
//equivalent to
if(yourstring[0] == EOS)
//equivalent to
if(!yourstring[0])
But, if you have isnull defined, use it instead.
Reply


Messages In This Thread
Pawn compiler crashing - by Aerotactics - 06.03.2014, 06:43
Re: Pawn compiler crashing - by Misiur - 06.03.2014, 08:00
Re: Pawn compiler crashing - by Aerotactics - 06.03.2014, 08:25
Re: Pawn compiler crashing - by Misiur - 06.03.2014, 08:30
Re: Pawn compiler crashing - by Aerotactics - 06.03.2014, 09:15

Forum Jump:


Users browsing this thread: 1 Guest(s)