🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9233

Re: macro to specify output paramet

#9233
From: karl
Date: Wed, 03 Sep 1986 19:06
27 lines
1627 bytes
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@haddock.isc.com), The Walking Lint
Technical Details
Message-ID: <86900036@haddock>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!think!ima!haddock!karl
References: <161@BMS-AT.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!think!ima!haddock!karl
From: karl@haddock
Newsgroups: net.lang.c
Subject: Re: macro to specify output paramet
Message-ID: <86900036@haddock>
Date: Wed, 3-Sep-86 15:06:00 EDT
Article-I.D.: haddock.86900036
Posted: Wed Sep  3 15:06:00 1986
Date-Received: Wed, 3-Sep-86 21:54:42 EDT
References: <161@BMS-AT.UUCP>
Lines: 27
Nf-ID: #R:BMS-AT.UUCP:161:haddock:86900036:000:1085
Nf-From: haddock!karl    Sep  3 15:06:00 1986