假設我有一段代碼:涉及指針到達定義
int x = 100;
int* p = &x;
*p = 20;
print(x); //<= reaching defitition of x?
它將在執行時輸出20。
問題是哪個語句是print(x)
的初始分配或指針賦值的到達定義?
另外,在下面的代碼:
void sub(int* p)
{
*p = 20;
}
int x = 100;
sub(&x);
print(x); //<= reaching defitition of x?
存在同樣的問題。是達到定義分析的特例還是需要特殊算法來處理?
「達到定義」是什麼意思? – Saphrosit 2012-07-07 13:52:36
它的到達定義http://en.wikipedia.org/wiki/Reaching_definition – Kii 2012-07-07 13:58:41