I see someone's been reading their documentation! That makes me very happy!
If anyone cares, here's a little more explanation as to WHY the forward is required. In PAWN everything has the same type (32 bit cell), however you can treat some variables differently using tags. Floats have the "Float" tag, true and false have the "bool" tag. "Float" starts with a capital so is strong, "bool" doesn't so is weak. Strong tags can only be stored in variables with the right tag, weak tags can be stored in any weak tag variable:
pawn Код:
new a = false; // Works.
new Float:a = false; // Shoulsn't work but does - see below.
Note that the default tag, the tag of everything with no specified tag is "_:".
PAWN actually has operator overloading - I bet very few of you knew that! So you can do:
pawn Код:
stock Moo:operator+(Moo:a, Moo:b)
{
return Moo:(_:a * 2 + _:b * 2);
}
Now if you do:
pawn Код:
new Moo:c = Moo:3 + Moo:4;
You will get 14, not 7.
Now if you look in float.inc you will see a whole load of overloaded operators, including this one:
pawn Код:
native Float:operator=(oper) = float;
Don't worry about the syntax, it uses a feature called internal/external names (another thing I bet you didn't know), but it means doing this will work:
a has tag "_:", b has tag "Float:". This shouldn't work but the overloaded "=" operator, which takes a variable of tag "_:" and returns a variable of tag "Float:" means that the compiler knows how to convert the two - this will compile as:
pawn Код:
new _:a = 5, Float:b = float(a);
Now imagine this code:
The compiler has no information about the function "moo" yet, so it generates this code:
pawn Код:
new Float:b = float(moo());
Then later on in your code you have:
Now the compiler knows that the "moo" function returns a "Float:" tag value, which means the code above using "float()" to convert from a float is wrong - hence the reparse. As Kyosaur said there are two ways to fix this. The first is to put the "moo" function before where it is used so that the compiler knows it returns a "Float:" tag, the second is to forward the function - again so the compiler knows it returns a "Float:", it just doesn't yet know what it does.