Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!know!tegra!vail From: vail@tegra.COM (Johnathan Vail) Newsgroups: comp.lang.c++ Subject: Bug or drain bamage? Message-ID: <2171@atlas.tegra.COM> Date: 15 Mar 91 20:18:45 GMT Organization: Tegra-Varityper, Inc., Billerica, MA Lines: 73 Is this a bug with Turbo c++? I am hoping it is just a difference between C and C++ that I am not aware of yet. This part of the program is still straight C. Given the following code, I want to call the function from the structure bp-> and pass to it the address of the structure (the pointer bp). Tracing shows that it gets there but bp is not being passed. i am thinking now that maybe the argument bp was already pushed (the optimizer moved it up a few lines or something) but the called function does not have it properly. (One more data: this used to work "old" tc before I started to convert the program to c++) ________________ THE C: /* * If there is a callback then call it with the ptr to the button */ if (bp->down_callback) { (bp->down_callback)(bp); } return; ________________ THE CPU INSTRUCTIONS: CPU 80286 #BUTTON#37: if (bp->down_callback) { cs:0796 837C0F00 cmp word ptr [si+0F],0000 cs:079A 7403 je #BUTTON#40 (079F) #BUTTON#38: (bp->down_callback)(bp); cs:079C FF540F call [si+0F] #BUTTON#40: return; cs:079F EB07 jmp #BUTTON#44 (07A8) #BUTTON#42: bp=bp->next; cs:07A1 8B7413 mov si,[si+13] ________________ THE typdef USED AND THE DECLARATION OF THE FIELD: typedef void (Function(ButtonPtr)); Function *down_callback; ________________ AND THE CALLED FUNCTION: void reverse_icon(ButtonPtr b) Thanks for any help. jv "Love is a snowmobile racing across the tundra and then suddenly it flips over, pinning you underneath. At night, the ice weasels come." --Matt Groening _____ | | Johnathan Vail | n1dxg@tegra.com |Tegra| (508) 663-7435 | N1DXG@448.625-(WorldNet) ----- jv@n1dxg.ampr.org {...sun!sunne ..uunet}!tegra!vail