Page 1 of 1

PostPosted: Wed Jan 16, 2002 9:18 pm
by kazymyr
Hi,

This is my first post here. I have just started using PocketC on my Visor, by porting one of my apps from Linux/gcc. The syntax of PocketC seems a bit strange, as for instance in a bit of code that goes like this (basically):
<pre id=code><font face=courier size=2 id=code>
//mynamehere
vsum(float dist[], int m)
{
int i=0; float t=0;
for(i=0; i<m; i++)
t+=dist[i];
return(t);
}
</font id=code></pre id=code>

...it complains that in line 2 "comma expected in function argument list" - but there is a comma! BTW this construction compiles just fine with gcc. Apparently, PocketC doesn't like arrays passed as arguments to functions, as if I make the first argument to be another type, it doesn't complain any more. I tried inverting the order of the arguments (i.e: int m, dist[]), and I still get the same error.

Edit: Argh - are the code tags disabled on this board? It eats up characters in line 5. Not that it matters for understanding the problem.

Edited by - kazymyr on 01/16/2002 15:26:53

Edited by - kazymyr on 01/16/2002 15:27:59

PostPosted: Thu Jan 17, 2002 1:07 pm
by kazymyr
OK, found in the docs: arrays not supported as parameters. Got around with pointers. On a side note, float t=5 gives a type mismatch? You'd think this conversion is automatic.