|
|
MyClass& operator=(int Op);
const int MyClass::MyStaticValue; // no initialization, as in header
= 200
) from the header to the cpp file. But it can only be in one of the two places.A = 15;
works if I pass on the integer by reference. If that static const variable does not have an address, why does a literal? Shouldn't it be both or none?
If that static const variable does not have an address, why does a literal? Shouldn't it be both or none? |
|
|
Notes add dest, src : This adds src to dest. call proc : pushes the address of the next opcode onto the top of the stack, and jumps to the specified location. lea dest, src : (Load Effective Address) calculates the address of the src operand and loads it into the dest operand. dest, src : (Move) copies the src operand into the dest operand. push arg : decrements the stack pointer and stores the data specified as the argument into the location pointed to by the stack pointer. eax : extended accumulator (for storage for intermediate results of arithmetic and logic) esp : extended stack pointer (address of top of stack) ebp : extended base pointer (address of bottom of current stack frame) (Intel syntax) |
19: write_int(0x1234); 0043CE39 C7 85 38 FF FF FF 34 12 00 00 mov dword ptr [ebp-0C8h],1234h 0043CE43 8D 85 38 FF FF FF lea eax,[ebp-0C8h] 0043CE49 50 push eax 0043CE4A E8 1F CC FF FF call write_int (439A6Eh) 0043CE4F 83 C4 04 add esp,4 20: return 0; |
19: write_int(0x1234); 0043CE39 68 34 12 00 00 push 1234h 0043CE3E E8 49 E0 FF FF call write_int (43AE8Ch) 0043CE43 83 C4 04 add esp,4 20: return 0; |
19: write_int(0x1234); 0040104E A1 3C 20 40 00 mov eax,dword ptr [__imp_std::endl (40203Ch)] 00401053 8B 0D 58 20 40 00 mov ecx,dword ptr [__imp_std::cout (402058h)] 00401059 50 push eax 0040105A 68 34 12 00 00 push 1234h 0040105F 51 push ecx 00401060 E8 4B 01 00 00 call std::operator<<<std::char_traits<char> > (4011B0h) 00401065 83 C4 04 add esp,4 00401068 8B C8 mov ecx,eax 0040106A FF 15 48 20 40 00 call dword ptr [__imp_std::basic_ostream<char,std::char_traits<char> >::operator<< (402048h)] 00401070 8B C8 mov ecx,eax 00401072 FF 15 40 20 40 00 call dword ptr [__imp_std::basic_ostream<char,std::char_traits<char> >::operator<< (402040h)] 20: return 0; |