Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++.dos.16-bits - 'this' is always to access to DS: ?
hi, all. 'this' is always NEAR pointer ? (access to DS: ?) % sc -c -0 -msw test.cpp % obj2asm test.obj > test.asm test.cpp: class CTest { public: CTest() : v(0) {} private: int v; }; void main() { CTest t; } test.asm: _main: push BP mov BP,SP sub SP,2 lea AX,-2[BP] // AX = [ this of t ] mov BX,AX mov [BX],0 // write DS:BX ... illigal !!, want SS:BX mov SP,BP pop BP ret Jun 09 2001
In small memory model, yes. It's best to use far memory models when SS!=DS. The w modifier is only useful for preventing the optimization in large memory models that assumes SS==DS. -Walter K.Takaoka wrote in message <3B22A2A3.F2042CE4 moonlight.gr.jp>...hi, all. 'this' is always NEAR pointer ? (access to DS: ?) % sc -c -0 -msw test.cpp % obj2asm test.obj > test.asm test.cpp: class CTest { public: CTest() : v(0) {} private: int v; }; void main() { CTest t; } test.asm: _main: push BP mov BP,SP sub SP,2 lea AX,-2[BP] // AX = [ this of t ] mov BX,AX mov [BX],0 // write DS:BX ... illigal !!, want SS:BX mov SP,BP pop BP ret Jun 09 2001
thansks, Walter wrote:The w modifier is only useful for preventing the optimization in large memory models that assumes SS==DS. Jun 09 2001
Not for classes. It will have an effect on things like memcpy(). The 80186 doesn't program any different than the 8088, hence there is no -1. In fact, it takes a very clever program to even distinguish any difference at all from a software standpoint (the trick is to do something with read/write instructions that will highlight a difference between an 8 bit write and a 16 bit write). -Walter K.Takaoka wrote in message <3B22B302.CA242731 moonlight.gr.jp>...thansks, Walter wrote:The w modifier is only useful for preventing the optimization in large memory models that assumes SS==DS. Jun 09 2001
|