This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Function switching

I am working on project with AT8052 with keil
While doing C coding i have created many functions at certain situation multiple nesting of functions occur which may be avoided with some effort. Since 8051 stack is inside the internal RAM itself and i am not using any external data memory, should i avoid multiple nesting of function as it may occupy more RAM area.

Regards

Nitin

Parents
  • Drew,
    I think we agree that coding is not pantyhose (one size does not fit all) and while some may lean one way and some may lean another way the truth is that in all cases "you shall not" should be replaced by "you shall only if good".

    My reaction on global variables is strongly flovored by exposure to some programmers that would rather screw up a program structure than use a global variable. I have also seen programmers coming from assembly using global variables where a local would be the better choice.

    So let's agree that the right choice is not what some "guru" stated a a "rule" but what is best for functionality and mainatainability (the ability to maintain it - not killing the code to protect it aginst you).

    Where functionality should take priority over mainatainability will always be a judgement call and I know that you can prioritize functionality without losing more than a few percent of maintainability if you keep thinking maintainability while coding functionality.

    Erik

Reply
  • Drew,
    I think we agree that coding is not pantyhose (one size does not fit all) and while some may lean one way and some may lean another way the truth is that in all cases "you shall not" should be replaced by "you shall only if good".

    My reaction on global variables is strongly flovored by exposure to some programmers that would rather screw up a program structure than use a global variable. I have also seen programmers coming from assembly using global variables where a local would be the better choice.

    So let's agree that the right choice is not what some "guru" stated a a "rule" but what is best for functionality and mainatainability (the ability to maintain it - not killing the code to protect it aginst you).

    Where functionality should take priority over mainatainability will always be a judgement call and I know that you can prioritize functionality without losing more than a few percent of maintainability if you keep thinking maintainability while coding functionality.

    Erik

Children
No data