<分区>
在这个程序中,我使用了 volatile 寄存器对象,
我实际上是将我的对象存储到此处的寄存器吗?
为什么我得到的对象地址是 1
?
请分享您对此的看法。
#include <iostream>
using namespace std;
class a{
int i,j,k[999];
long double arr[9999999];
public:
a(){
i=77; j=89;
cout<<"\nctor\n";
}
void disp()volatile {
cout<<"\ni = "<<i<<" j = "<<j<<"\n";
// delete this;
}
~a(){
cout<<"\ndtor\n";
}
};
int main(){
register volatile a *ao = new a;
cout<<"address of a = "<<ao; //out puts "1" for me; (My processor is core i3 330M).
ao->disp();
delete ao;
}