Re: A89: Parse Error


[Prev][Next][Index][Thread]

Re: A89: Parse Error




> I just decided to try to write a program for the 89 using TIGCC.. For some
> reason, I get a parse error when I do this:
>
> int Routine(int& p1, int& p2, int& p3)
> {
>  DrawStr(15,75,"Calculator",A_NORMAL);
>  ngetchx();
>  DrawStr(15,75,"Calculator",A_XOR);
>  return 0;
> }

Passing reference parameters isn't supported in C.  In other words, you want
to pass "int", not "int&".


I'm not exactly sure, but I think that there's no point in passing them as
reference when they're ints that aren't modified in the function.  IIRC,
passing reference parameters is just a simplified syntax that's identical to
passing a pointer to the value.  In TI-GCC, an int defaults to 16 bits,
while a pointer is 32 bits (although only 24 are needed, the only type that
accomodates that is a longword).  I _think_ it translates into faster ASM
when you're only passing words instead, although that might be different if
TI-GCC has those somewhere on the stack already. . .

    -Scott