Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Functions that lead to other functions

Question about programming in general:
Is it bad to have functions that lead to other functions?
Is it a big impact on performance?
For example,
Code
object4s(float s1, float s2, float s3, float s4)
{
//create object.....
}
object1s(float s)
{
object4s(s,s,s,s);
}
(Mar 28, 2013 10:37 AM)Breakout Wrote:  Question about programming in general:
Is it bad to have functions that lead to other functions?
Is it a big impact on performance?
For example,
Code
object4s(float s1, float s2, float s3, float s4)
{
//create object..
}
object1s(float s)
{
object4s(s,s,s,s);
}

Depends on the functions and how you defined them.
(Mar 28, 2013 10:37 AM)Breakout Wrote:  Is it bad to have functions that lead to other functions?

Not always, but it depends on how you are coding the functions to work together. Building out a framework can lead to a lot of calls inside of functions to others, but in most cases that's how things are going to land up to ensure things are dynamic and flexible.

(Mar 28, 2013 10:37 AM)Breakout Wrote:  Is it a big impact on performance?

It can be if you are chaining a lot of calls. The call stack can become massive (and even overflow if you have a lot of recursion etc.)