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

Username:   Password: 
 RegisterRegister   
 Exporting a variable?
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
atrain




PostPosted: Mon May 30, 2005 5:13 pm   Post subject: Exporting a variable?

Is it possible to export a variable?

basicly, i want to have modules of my program to use the same variables

For example:
Main.t
var a,b,c : int := 0

Module.tu
a:=b
b:=c
Sponsor
Sponsor
Sponsor
sponsor
atrain




PostPosted: Mon May 30, 2005 5:23 pm   Post subject: (No subject)

Ok, i realized that i can just use them when calling anything...
eg:
process something (a,b,c:int, d:string)

but is there an easier way??
Cervantes




PostPosted: Mon May 30, 2005 5:29 pm   Post subject: (No subject)

You should pass these things in as parameters. The subroutines should have as little knowledge of the outside world as possible, save the values you feed them through parameters.
atrain




PostPosted: Mon May 30, 2005 6:00 pm   Post subject: (No subject)

hmmm

the problem is now i cant send the variables back...

these processes are looking at the players position, comparing them to the object, and relocating them if nessisary...

is there any other way? or will i have to move it back the the main prog...
lyam_kaskade




PostPosted: Mon May 30, 2005 6:13 pm   Post subject: (No subject)

If the module returns a value (Eg. Yes/No), then you can just make Main do whatever based on the value returned.
Cervantes




PostPosted: Mon May 30, 2005 6:19 pm   Post subject: (No subject)

Yep. Also, you shouldn't be using processes. They'll do crazy things to programs, like make them suck. Wink
atrain




PostPosted: Mon May 30, 2005 6:59 pm   Post subject: (No subject)

im using procedures not processes

also, why do processes suck?

they let you do more than 1 thing at once!
Cervantes




PostPosted: Mon May 30, 2005 7:10 pm   Post subject: (No subject)

Why do processes suck, you ask? Well, allow me to explain.
You're not really doing two things at the same time. It's more of a 'execute this process, then execute that, then go back to the first, then, hmmm... let's execute the first one again, now we'll go to the second. Woopie, the program was just slightly screwed. Let's keep going like this!'
You don't really need to use processes. You only think you do. Yes, I did too at one point. You just have to get your head around the idea of one loop doing multiple things for you. Once you do, you probably won't want to go back to using processes.
Sponsor
Sponsor
Sponsor
sponsor
atrain




PostPosted: Mon May 30, 2005 9:19 pm   Post subject: (No subject)

hmm

if i change them to procedures, i can call then anytime needed...

and that helps controll them better

funny the whole thing was about procedures not processes...
[Gandalf]




PostPosted: Mon May 30, 2005 9:47 pm   Post subject: (No subject)

It's strange, I never had a problem with proccess's, at first I though procs and process's were the same. When I learned otherwise, I just used procedures...

Hmm, would it be possible to make a command that actually does execute two things at once? That way, even our music could be process free!
c0bra54




PostPosted: Mon May 30, 2005 9:59 pm   Post subject: (No subject)

sigh.. there is a cheat section of turing.. something to do with sending machine code to processor.. would it be physically possable to rewrite the proces thingy.. or is that WAY out of the question lol??

i meen, i know it's impossible to do two things ato once, but could we have then execute nearly same time, and make sure they enevr mess up

like make sure it does

1212121212121212
instead of

121211212221212111121212121

???

experienced ppl please w00t lol
atrain




PostPosted: Mon May 30, 2005 10:07 pm   Post subject: (No subject)

most of the time i use processes, i dont care if its not aligned


eg:
dont care if its 12212121212111212122221121

sometimes id do a mouse.where or fork off a music.playfile (i know about music.playfilereturn now)

so that dont bother me, for areas that do, i dont use them


ANYWAYZ

due to all your help, i have to put the whole thing back into the original file, because none of you will tell me the answer i want...
lyam_kaskade




PostPosted: Mon May 30, 2005 10:14 pm   Post subject: (No subject)

Wouldn't putting one after the other be almost the same time?
c0bra54




PostPosted: Tue May 31, 2005 10:40 am   Post subject: (No subject)

well the thing is that windos doesn't do things like Dos used to...

windows gives cycles to each program, so like your entire computer is sharing one process and that one processor can do only one thing at a time... so no technically they are never happen right after one another, and if in the middle of a program between two things that are set to come after each other, if windows since it gets more cycles) decides to shove in a sytems operation, the processor will slide your program off for a millisecond, do the windos thing,m then get back to you.. but what i want to know .. is there a way to tell the processor that these two things are more important then everything, so it should do them right after one another.. cause process's don't REALLY do that...
atrain




PostPosted: Tue May 31, 2005 9:10 pm   Post subject: (No subject)

linux POSIX threads have priority...
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 2  [ 16 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: