From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,71dcda1787f0bed5 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Success: Ada versus C Date: 1997/06/09 Message-ID: #1/1 X-Deja-AN: 247273125 References: <33984686.9A8@gdls.com> <5n9l3m$f2e$3@mdnews.btv.ibm.com> <5ngt2t$ei8$2@mdnews.btv.ibm.com> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-06-09T00:00:00+00:00 List-Id: Dale says <> OK, understood. It is hard for me sometimes to guess what misconceptions people might have, but yes of course call by value is more efficient for values that fit in registers. Indeed this is why Fortran does not require call by reference. A typical Fortran compiler, like a typical Ada compiler, uses call by value for register sized scalars, and call by reference for large stuff, and there are some cases in between which are target dependent (for example, the SPARC ABI (unwisely) requires all structures to be passed by reference, but many other ABI's permit the more efficient approach of passing register sized structures by value in registers -- note that it is particuarly annoying to be forced to pass structs by reference at the ABI level in C, because C requires call by value for structs at the language level. This means that a typical SPARC C compiler that obeys the ABI must first copy a small struct to memory and then pass its address, instead of just passing it in a register.