Porting to PocketC...error?

Postby kazymyr on Wed Jan 16, 2002 9:18 pm

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
kazymyr
 
Posts: 2
Joined: Wed Jan 16, 2002 9:02 pm

Postby kazymyr on Thu Jan 17, 2002 1:07 pm

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.
kazymyr
 
Posts: 2
Joined: Wed Jan 16, 2002 9:02 pm


Return to PocketC for Palm OS KB

Who is online

Users browsing this forum: No registered users and 3 guests

cron