did old compilers give warning on &struct?

Esmond Pitt ejp at bohra.cpg.oz
Mon Nov 13 11:49:38 AEST 1989


In article <465 at siswat.UUCP> buck at 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 at bohra.cpg.oz



More information about the Comp.lang.c mailing list