Computer Science Canada "Prototype" of functions |
Author: | Ratinho [ Mon Jun 07, 2010 5:03 pm ] | ||
Post subject: | "Prototype" of functions | ||
What is it you are trying to achieve? I want to call 2 functions: one from each other What is the problem you are having? The compiler doesnt "know" the function if it defined lower then the place i try to call it, and i cant defined two function mixed:S its like one of the reason for function`s prototype in c/c/++ Describe what you have tried to solve this problem i tried export and things like that... Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) Plz dont suggest me other solutions...im trying to build compiler, and i need that to implement my grammer...
Notice to the relationship between term() and expression() Please specify what version of Turing you are using the newest Thank you very much guys ![]() |
Author: | TerranceN [ Mon Jun 07, 2010 5:20 pm ] | ||
Post subject: | RE:"Prototype" of functions | ||
You can do this using the forward and body keywords like this:
|
Author: | Cezna [ Tue Jun 08, 2010 5:39 am ] |
Post subject: | RE:"Prototype" of functions |
If you are OK using procedures (at least for one of the things), then use forward procedure for the declaration at the top, and body procedure for the actual procedure. I don't think there's any way to do this with functions. By the way, TerranceN, how do you have everything in the code formatted right. Did you just do it manually by tagging everything a certain way? |
Author: | TerranceN [ Tue Jun 08, 2010 6:21 am ] | ||||
Post subject: | Re: "Prototype" of functions | ||||
I know you can do this with functions, I have done it before. I'm on Ubuntu (linux, no Turing) at the moment so forgive me if my syntax is wrong:
As for the formatting use syntax tags
|
Author: | Cezna [ Tue Jun 08, 2010 10:50 am ] | ||||
Post subject: | RE:"Prototype" of functions | ||||
Ok, so you can do it with functions. So Ratinho, all you have to do is put this at the top:
and this at the function
The forward function line acts as the declaration statement, so as long as this is above any calls to the function, there shouldn't be any problems. |
Author: | Ratinho [ Sun Jun 20, 2010 2:12 pm ] |
Post subject: | RE:"Prototype" of functions |
hey guys tnx! it was great solution (the forward and body ![]() i used it in the day after u post it, sry that i reply only now =] u r really useful guys! |
Author: | Cezna [ Sun Jun 20, 2010 6:58 pm ] |
Post subject: | RE:"Prototype" of functions |
Maybe useful enough for +bits or +karma? ![]() |
Author: | Monduman11 [ Sun Jun 20, 2010 7:24 pm ] |
Post subject: | Re: RE:"Prototype" of functions |
Cezna @ Sun Jun 20, 2010 6:58 pm wrote: Maybe useful enough for +bits or +karma?
![]() lol quick question what are bits and karma used for anyways? |
Author: | TerranceN [ Sun Jun 20, 2010 7:39 pm ] |
Post subject: | RE:"Prototype" of functions |
umm... Feeling badass? I don't think its used for anything. |
Author: | USEC_OFFICER [ Sun Jun 20, 2010 7:42 pm ] |
Post subject: | RE:"Prototype" of functions |
It used for giving to people as a way of saying 'Great job' or 'You're awsome' or something like that. |
Author: | Cezna [ Sun Jun 20, 2010 7:45 pm ] |
Post subject: | Re: "Prototype" of functions |
Go here to read about bits. Karma is just to show how helpful/unhelpful a person is in general. |