Okay, time fer a light pestering.
Came across this little bugaboo in my travels and it sparked a question that I haven't been able to find an answer to...
Say I have a function
void hacks(int& b);
or
void hacks(int *b);
To call properly for the first:
int Al_Bundy;
hacks(Al_Bundy); (For the first)
hacks(&Al_Bundy); (second)
Both pass references into the functions instead of an actual value... Why two ways of doing the same thing? Are there advantages of doing it one way or the other? Or am I missing something?
I ask because I have seen both within the same open source project... yet both seem to do the same thing, no?
Kirock and Leroy BATSIGNAL!!!
Lol.
EDIT: in bold. I can't type..
Came across this little bugaboo in my travels and it sparked a question that I haven't been able to find an answer to...
Say I have a function
void hacks(int& b);
or
void hacks(int *b);
To call properly for the first:
int Al_Bundy;
hacks(Al_Bundy); (For the first)
hacks(&Al_Bundy); (second)
Both pass references into the functions instead of an actual value... Why two ways of doing the same thing? Are there advantages of doing it one way or the other? Or am I missing something?
I ask because I have seen both within the same open source project... yet both seem to do the same thing, no?
Kirock and Leroy BATSIGNAL!!!
Lol.
EDIT: in bold. I can't type..