Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!munnari.oz.au!murtoa.cs.mu.oz.au!ditmela!yarra!bohra!ejp From: ejp@bohra.cpg.oz (Esmond Pitt) Newsgroups: comp.lang.c Subject: Re: did old compilers give warning on &struct? Keywords: & struct passing Message-ID: <112@bohra.cpg.oz> Date: 13 Nov 89 00:49:38 GMT References: <465@siswat.UUCP> Reply-To: ejp@bohra.cpg.oz (Esmond Pitt) Organization: Computer Power Group, Melb, Australia Lines: 26 In article <465@siswat.UUCP> buck@siswat.UUCP (A. Lester Buck) writes: >In a recent discussion with a co-worker, he claimed that several (many?) >early C compilers, before the support of structure passing, would give a >warning if there was an & before a structure in a function call, similar to >the (correct) warning for an & before an array. He claims he and many >others wrote a lot of code that removed the & to shut up the warnings, but >were then caught when a later version of these compilers started supporting >structure passing. > >I have _never_ heard of or used such a brain-dead compiler. Did such >compilers exist, and can I run into large pieces of code that don't have & >before struct parameters passed by reference? Before structure name arguments => pass by reference was supported, structure name arguments were passed _by_value_. Therefore your co-worker seems to have it back to front: as the programmer at that time probably intended a pass-by reference rather than stacking some potentially huge structure, there may have been C compilers which complained if the & was _missing_. Indeed the compiler may not have supported passing aggregates by value. (I have never seen either behaviour.) -- Esmond Pitt, Computer Power Group ejp@bohra.cpg.oz