Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!usc!apple!marc From: marc@Apple.COM (Mark Dawson) Newsgroups: comp.sys.mac.programmer Subject: passing correct var size in MPW C/C++ Message-ID: <43315@apple.Apple.COM> Date: 24 Jul 90 22:48:46 GMT References: <26ACA0CB.542F@wilbur.coyote.trw.com> Distribution: usa Organization: Apple Computer Inc, Cupertino, CA Lines: 37 I wrote a routine in assembly that I wanted to call from my C++ code, it didn't end up working the way I expected--the C++ call kept passing a long, when my assembly was expecting a short (2 bytes). I've of course modifed my assembly to expect a long, but I'd like to know where my thinking went wrong. extern "C" void myProc(short x); // external declaration .... short vRefNum = -2; myProc(vRefNum); // I also tried myProc((short)vRefNum) and got the same res ... -------- myProc PROC EXPORT .... move.l (sp)+,A0 // pop return @ off stack move.w (sp)+,D0 // get vRefNum off stack .... ENDP -------- When I did a debugger trap in myProc(), the stack always had an $FFFF FFFE, not the $FFFE that I expected--it seemed to be passing 4 bytes instead of two. Why? Thanks, Mark -- --------------------------------- Mark Dawson Service Diagnostic Engineering AppleLink: Dawson.M Apple says what it says; I say what I say. We're different ---------------------------------