RE: A89: Re: Parse Error
[Prev][Next][Index][Thread]
RE: A89: Re: Parse Error
Thank you so much :)
By the way, incredible IDE program, it's what made me want to code for the
89 in C in the first place. Thanks.
-Ahmed
-----Original Message-----
From: owner-assembly-89@lists.ticalc.org
[mailto:owner-assembly-89@lists.ticalc.org]On Behalf Of Sebastian
Reichelt
Sent: Sunday, June 11, 2000 7:20 PM
To: assembly-89@lists.ticalc.org
Subject: A89: Re: Parse Error
Hi!
| 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;
| }
The reason this doesn't work is that C, unlike C++, doesn't support passing
parameters by reference. Instead, you have to use pointers. This should
fix it, although I don't see what the parameters actually do:
int Routine(int* p1, int* p2, int* p3)
{
DrawStr(15,75,"Calculator",A_NORMAL);
ngetchx();
DrawStr(15,75,"Calculator",A_XOR);
return 0;
}
If you called it like this before:
Routine (a, b, c);
you have to do it this way now:
Routine (&a, &b, &c);
This will pass pointers to a, b, and c. If you use the parameters somewhere
in the function, you have to use *p1 instead of p1 now (to dereference the
pointers).
I hope this helps. It's kind of surprising that this doesn't even work in
GNU C, but I guess this extension is just not included. Pascal has this
problem solved, and I think there is a Pascal compiler for TI-89s, called
UltraPascal. I'm going to look into that sometime, just to see what it can
do.
Bye,
Sebastian
Follow-Ups:
References: