Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Need Procedures Help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
s33nw33n




PostPosted: Thu Jun 15, 2006 4:32 pm   Post subject: Need Procedures Help

Hi.
Say if I have a program setup like this:

code:

procedure 1
....
end 1

procedure 2
....
end 2

procedure 3
....
end 3


If I want to use procedure 3 in procedure 1, it will give me a error that procedure 3 hasn't been declared because its below the code. Is there a way to tell the program to go down and check the rest of the code before giving an error?

Thanks[/code]
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Thu Jun 15, 2006 4:47 pm   Post subject: (No subject)

Ah, circular dependance. TOTG will likely be by soon enough to give you further details to this wonderful problem which he has had more than his share of time in, but essentially you do something like this:

code:

forward proc _1

body proc _1
%...
end proc _1


I'm not entirely certain if this is the syntax, but that's the general idea. I will, however, ask you if you can think of no other way to solve your problem other than using this form of coding - which if you're not careful, can be quite painful to debug. Not to mention dangerous if you hit two procs that indefinitely call each other!
s33nw33n




PostPosted: Thu Jun 15, 2006 4:50 pm   Post subject: (No subject)

Delos wrote:

I will, however, ask you if you can think of no other way to solve your problem other than using this form of coding


Thanks Delos. I SERIOUSLY appreciate this. My projects due tomorrow.

Well, all procedures are interconnected together, so I have to find a way to do this. Thanks, I will play around with the forward/body stuff and see if I can get this to work.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: