Home > Back-end >  Is not the same as the address, the output value is? Why is that?
Is not the same as the address, the output value is? Why is that?

Time:11-08

CodePudding user response:

Because it is a const int, although you changed the value inside the pa,
cout CodePudding user response:

By this time the data value is 60
You know the output data, see again

CodePudding user response:

Should be the role of the const modifier

CodePudding user response:

 001 e18cd call @ __CheckForDebuggerJustMyCode @ 4 (01 e1226h) 
Const int a=97;
001 e18d2 mov dword PTR [a], 61 h
Int * p=(int *) & amp; a;
001 e18d9 lea eax, [a]
001 e18dc mov dword PTR [p], eax
* p=10;
001 e18df mov eax, dword PTR [p]
001 e18e2 mov dword PTR [eax], ah 0
cout 001 e18e8 mov esi, esp
001 e18ea push offset STD: : endl (01 e1253h)
001 e18ef mov edi, esp
61 h/001 e18f1 push/pay attention to the words
001 e18f3 mov ecx, dword PTR [__imp_std: : cout (01 eb0a8h)]
001 e18f9 call dword PTR [__imp_std: : basic_ostream & lt; char, STD: : char_traits & lt; char> & gt; : : operator<& lt; (01 eb09ch)]
001 e18ff CMP edi, esp
001 e1901 call __RTC_CheckEsp e1230h (01)
001 e1906 mov ecx, eax
001 e1908 call dword PTR [__imp_std: : basic_ostream & lt; char, STD: : char_traits & lt; char> & gt; : : operator<& lt; (01 eb0a0h)]
001 e190e CMP esi, esp
001 e1910 call __RTC_CheckEsp e1230h (01)

When a const variable as a function of the parameters, the compiler will tend to direct that the value of the variable as a function literal incoming
  • Related