Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Exit All Functions

Author
Message
tonycrew
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location:
Posted: 6th Mar 2010 19:55
Hey, Today I want to either know a command to Exit all Functions. Or to know how to exit another function through a function.

Thanks, Appreciated!

FPS Creator Updated 116,Vista 32Bit UpTo Date, nVidea 8500 1Gig Graphics Card, 4 Gig DDR2 Ram, Intel Duel Core 3GHZ CPU
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 6th Mar 2010 20:54 Edited at: 3rd Sep 2010 18:04
Doesn't exist.

You can exit the current function that's being executed using Exit Function, but that's about it.

tonycrew
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location:
Posted: 6th Mar 2010 21:14
Ok, It's just that.. In my function, I call a function then bla bla that function ends but the original function is still running.

FPS Creator Updated 116,Vista 32Bit UpTo Date, nVidea 8500 1Gig Graphics Card, 4 Gig DDR2 Ram, Intel Duel Core 3GHZ CPU
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 6th Mar 2010 21:23
No it isn't. When you change control (call a function), then the CPU stops executing whatever code it was doing, and then starts running whatever you've told it to.

So, If you have a function BILL() that calls another function HELLO() within it, then the CPU will halt executing BILL() when it runs into the HELLo() call. At the completion of the HELL0() function (via either End Function or Exit Function), the CPU picks up where it left off executing BILL().

At the completion of the BILL() function, the cpu returns back to wherever BILL() was called from. And resumes executing from that position.

At no time are BILL() and HELLO() executing together (in unison)

qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 8th Mar 2010 14:39 Edited at: 8th Mar 2010 14:40
in "cooler languages" aka c++ can you have multiple functions running concurrently, aka, a function handling all the vehicle entities, a function handling player, a function handling skyspace, all running at the same time?

that'd help with averaging out framerate i think

p.s. spill all you know. i like learning about how computers are thinking, behind the scenes of my code
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 8th Mar 2010 15:44
@qwe: No, unless you can set up complicated things like multithreading. All programming languages work in this line-by-line way.

Masqutti
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 8th Mar 2010 15:48 Edited at: 8th Mar 2010 15:52
Basicly in every language There's no possibility to run anything at the same time. Well I guess new processors like quad cores can handle things at the same time, but that's another topic. When you have one processor(1 calculator) you can calculate one thing at a time. That means Everything you code is run in a queue, or a list "to-do" things.

You can have multiple functions that control different things, or a function that control many things. But they're all done in a sequence, one at a time. Then, the frame syncing makes the computer seem that it does many things at the same time.
Like:


This does input all the n's on the screen at one frame. It seems to you that it's done at the same time as it appears to the screen instantly. But you know, the data has been run through the processor on a queue, driven into a memory/GPU memory or something and then displayed on the screen. It must be calculated/prosessed first, then banked into a memory and finally applied to the screen to show the effect.

a prosessor is a calculator that does one event at a time. Thus it's so fast, it seems it's doing a hundred of things as the same time, but it's all one huge queue of binary 00011000100101010 running

The quad processor etc. Can run 4 things at the same time I guess(simplified) and then the GPU has its own memory for shaders and for other things like textures, But i dunno do they usually have multiple processors(?) But well. It's always 1 calculation for 1 processor..

hmmmh.. that didn't compile
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 9th Mar 2010 04:21
Quote: "Ok, It's just that.. In my function, I call a function then bla bla that function ends but the original function is still running."


You aren't structuring your program correctly, or you are using functions incorrectly.

I've nothing against functions - they definitely have their uses, but you could probably write what you are writing without using them at all. If you start a program with the correct foundations, you don't have these problems when you build on it.

Functions are ideal for some tasks and have no advantage over subroutines for others. Use them only when you need to.

TDK

Login to post a reply

Server time is: 2024-11-16 11:16:14
Your offset time is: 2024-11-16 11:16:14