by-ref parameters, aggregate co

karl at haddock karl at haddock
Thu Sep 4 05:45:00 AEST 1986


umcp-cs!chris (Chris Torek) writes:
>> 	foo(c) char &c; { ...
>I have no great love for this syntax either; but how else do you
>propose to add by-reference parameters?

Since you asked.  I once suggested "foo(&c) char c; { ... }"; this makes the
declaration in the callee match the syntax in the caller.  However, I have
since decided that the more general reference objects a la C++ are better,
since it allows you to write "lfunctions" that can be used on the left side
of an assignment (e.g. "x = pop(); ...; push() = x").  But as I mentioned in
another posting, "char *&c" is more consistent than "char &c" to declare a
reference.  (And it's probably better than adding a new keyword.)

Karl W. Z. Heuer (ima!haddock!karl; karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list