Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!sgi!shinobu!odin!yumyum.esd.sgi.com!daifuku From: daifuku@yumyum.esd.sgi.com (Peter Daifuku) Newsgroups: comp.sys.apollo Subject: Re: function prototype mystery? Message-ID: <1991Apr12.013850.2047@odin.corp.sgi.com> Date: 12 Apr 91 01:38:50 GMT References: <1991Apr11.164655.17092@milton.u.washington.edu> Sender: news@odin.corp.sgi.com (Net News) Reply-To: daifuku@yumyum.esd.sgi.com (Peter Daifuku) Organization: Silicon Graphics Inc. Lines: 30 > void proc2_$get_info( > uid_$t &p2_uid, > proc2_$info_t *info, > pinteger &info_buf_len, /* size of info buffer (bytes) */ > status_$t *sts > ); > > What do the &'s do to the first and third arguments? > It looks to me like the function expects addresses, but if > I pass addresses to it, the compiler (cc 6.7.m, OS10.3) complains > that the argument type conflicts with the declaration. > > What works is something like proc2_$get_info(p2_uid,&info,bufferlength,&status).Why? Is this some kind of > > apollo-ism, or something ANSI-like? This one threw me for a loop too, when I first encoutered it. It's actually a C++-ism, and thus an APOLLO enhancement to C. It allows you to pass arguments by reference, without specifically passing the address. Hence, the caller sends p2_uid, as opposed to &p2_uid, and the callee can reference p2_uid directly, instead of *p2_uid. Since the argument is being passed by reference, any modifications by the callee are seen by the caller. Peter Daifuku Silicon Graphics daifuku@sgi.com Mountain View, CA 94039 ---------------------------------------------------- Knowledge is power! Now, who said that?