H
Howard
Hi,
in one of the recent posts, I saw someone pass two variables of built-in
type (int and double), by reference, to a member function of a class. That
function then took the addresses of those reference parameters and stored
the results in member pointer variables.
Is that guaranteed to be ok? In other words, does taking the address of
a reference to a built-in type give you the address of the original
variable? I'd expect so (not having a clue what it might do instead) but it
seems very strange to me.
Personally, I'd have used pointers as the parameters themselves (passing
the address of the variables to the function), and then just copied the
pointers' contents to my member variables. But I'm just wondering if it's
ok (and/or normal?) to take the address of a reference to a variable (of
built-in type, which has no member operator & to call, as a user-defined
object might).
Thanks,
-Howard
in one of the recent posts, I saw someone pass two variables of built-in
type (int and double), by reference, to a member function of a class. That
function then took the addresses of those reference parameters and stored
the results in member pointer variables.
Is that guaranteed to be ok? In other words, does taking the address of
a reference to a built-in type give you the address of the original
variable? I'd expect so (not having a clue what it might do instead) but it
seems very strange to me.
Personally, I'd have used pointers as the parameters themselves (passing
the address of the variables to the function), and then just copied the
pointers' contents to my member variables. But I'm just wondering if it's
ok (and/or normal?) to take the address of a reference to a variable (of
built-in type, which has no member operator & to call, as a user-defined
object might).
Thanks,
-Howard