3fd Subj : Re: Inline Assembler bug with structs of certain size To : borland.public.cpp.borlandcpp From : Bob Gonder Date : Thu Dec 02 2004 05:19 pm Bob Gonder wrote: >Try >> printf("&TestStruct1 = %4p, via asm = %p\n", &TestStruct1, asm_test1()); > >At least, on my machine, it pushes ds:address for &TestStruct1 and >cs:value for asm_test1(). > >The %p properly uses the 16bit address instead of the original 4 and 4 >(ignoring the second parameter) Should be 32 bit full address instead of the 2 16bit values. BTW, talking of shifty data..... Test.h extern long Three; extern long Two; extern long One; Test.c #include "test.h" long One; long Two; long Three; short Value(void) { asm{ mov ax, word ptr[Two+4]; }; return _AX; } int main(void) { One=1; Two=2; Three=3; printf( "\r\n Value=%i \r\n",Value() ); return 0; } What is the value? Now change Test.h to extern long One; extern long Two; extern long Three; Now what is Value? . 0