macro to specify output paramet
karl at haddock
karl at haddock
Thu Sep 4 05:06:00 AEST 1986
BMS-AT!stuart writes:
>[re the declaration of reference types "foo(char &c)"]
>I don't like this. It violates the nice consistent way that C expressions
>work. 'char *c' means that '*c' is of type char. '&c' is not of type
>char in any other context.
I am also somewhat uneasy about calling it "char &c". The consistent way to
declare it would be "char *&c", since you have to write "&c" to get ahold of
the "char *" object you are really using.
>I would like to see "structure constants" which would allow assignment to
>aggregate types.
> complex z;
> z = { a+1, exp(b) };
> foo( (complex) { a, b } );
The problem, as your last example points out, is that the notation "{...}"
doesn't distinguish between different structure types. I suppose the cast
notation is workable, but kinda ugly.
>Of course any of these could be coded by assigning each member in turn.
No, the last example requires assigning each member to a temporary, and then
passing that temporary as an argument.
Karl W. Z. Heuer (ima!haddock!karl; karl at haddock.isc.com), The Walking Lint
More information about the Comp.lang.c
mailing list