int g_myInt = 0;
int& getIntReference() { return g_myInt; }
void myVarArgFunction( int a, ... ) {
// .........
}
int main() {
myVarArgFunction( 0, getIntReference() );
return 0;
}
In the (uncompiled and untested) C++ code above, is it valid to pass in an int& into a variable argument list? Or is it only safe to pass-by-value?