Multiple functions
In c++ can u call multiple functions to run at the same time.
My book says that a program stops and executes a function when it is called. But it doesnt say if more than one function can be called or executed at the same time. thx
only if you use threads....and even then, things are never executed at the same time on a pc unless it has more then one processor. But by using threads....it will seem like it is.
just look into threads
"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T
just look into threads
"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T
The reason i am asking this is when you get into higher programming and you need to say check for collision of an object and the camera frustrum at the same time, wont you have to call these as seperate functions at the same time
If you don''t make anything happen between the two checks, as far as the world is concerned, it''s just as if you checked them simultaneously.
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
The C and C++ languages do not have intrinsic support for concurrent processing (although, as was already stated, you can achieve some of the effect with multithreading - and I would not be surprised to find that there are third-party libraries with added functionality for architectures that support it). Of course, like Fruny said, there is no need for anything of the kind in the case you mentioned.
The Corner of Misery
href="http://elfwod.lysator.liu.se/~haggholm">Artwork and href="http://elfwod.lysator.liu.se/~haggholm_2">writing
The Corner of Misery
href="http://elfwod.lysator.liu.se/~haggholm">Artwork and href="http://elfwod.lysator.liu.se/~haggholm_2">writing
So even if i had to perform 10 checks on the object and i wote them one after the oher they would appear to run simutaneously.
quote: Original post by Micromania
So even if i had to perform 10 checks on the object and i wote them one after the oher they would appear to run simutaneously.
Pretty much yes, since you''re then one who controls when game time actually advances ( update function ). Though of course, if your tests take too much real time, the game will be choppy ( low frame rate ).
[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Can functions be caled within functions say:
void function1()
{
}
void function2()
{
function1()
}
int main()
{
function2()
return 0;
}
Will this execute function 1 and function 2 when only function 2 is called apon
void function1()
{
}
void function2()
{
function1()
}
int main()
{
function2()
return 0;
}
Will this execute function 1 and function 2 when only function 2 is called apon
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement