foo1(bar &x), foo2(bar &x), foo3(bar &x) ...a better way?

Oct 9, 2009 at 5:47pm
Is there a better way to do this? Currently, the user being passed into all those functions throughout the program is always the same, so is there some way I can make the user universally available and still manipulatable by all of the foos()?

1
2
void mainMenuFirst(user &x), initialization(user &x), loadGameData(user &x), saveGameData(user &x);
void game(user &x), gameMenuFirst(user &x), gamePlay(user &x), gamePlayBattle(user &x), levelCheck(user &x);
Oct 9, 2009 at 6:44pm
Well you could make a global instance and then change all the functions to not pass the parameter, but that is kind of the antithesis to good programming practice. The only justification is if you need to squeeze every last ounce of performance out of the code and you want to avoid the extra PUSH instruction.
Oct 9, 2009 at 10:28pm
Currently, the user being passed into all those functions throughout the program is always the same
The key word here is "currently".
Topic archived. No new replies allowed.