참조가 함수의 매개 변수이고 해당 함수가 인라인 된 경우 참조가 참조 자체가 아니라 포인터 일 필요는 없지만 참조가 매개 변수가 아니라 함수 또는 글로벌 로컬, 또는 인라인 함수의 출력 : 기준이 소스 파일의 끝에 글로벌 NUM을 가리키고 글로벌 때이러한 경우에 참조 처분은 어떻게됩니까?
//global scope
void someFunc(SomeType & ref){//when function is inline, it's possible for ref to be the referent itself
//function body
}
int num=7;
int & ref=num;//what about ref here?
void someFunc1(){
int num=6;
int & ref=num;//what about ref here?
//rest of function body
}
int & someFunc2(){//what about output reference here when function is inlined, will it be num itself or a pointer ?
int num=8;
return num;
}
문제는 정확히 "가리킨다"가 의미하는 것입니다. – Pooria
ref를 변경하면 num이 변경됩니다. 심판 대신 num을 쓰는 것과 정확히 같습니다. – Marii
아니요, 그 뜻이 아니 었습니다. 포인터 또는 지시 대상의 별칭 일 것입니다. – Pooria