🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #772

Re: parameter type matching

#772
From: diamond
Date: Mon, 31 Dec 1990 06:54
40 lines
2366 bytes
Subject: Re: parameter type matching (was Re: the SUN way)
In article <1990Dec24.112015.4426@zorch.SF-Bay.ORG> xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) writes:
>diamond@tkou02.enet.dec.com ("diamond@tkovoa") writes:
>>Here in pseudo-C syntax:
>>  typeof(x) *bsearch(const any (*x)[], const typeof(x) *,
>>                     unsigned, unsigned,
>>                     int(*)(const typeof(x) *, const typeof(x) *));
>How about:
> typeof(x) *bsearch(const any (*x)[], const oftype(x) *,
>                    unsigned, unsigned,
>                    int(*)(const oftype(x) *, const oftype(x) *));
 
My understanding was that gcc calls it typeof.  (Though gcc's construct
is not powerful enough to back up from the parameter declaration to the
function return type.  The 1989 Extended Pascal standard can do it because
function return types come after the parameter declarations.)
 
I don't care if you want to call it oftype instead of typeof.
But you missed one.
> typeof(x) *bsearch(const any (*x)[], const oftype(x) *,
  oftype
 
>Also, looking at it, I would assume that "x" is of type "pointer to
>function", and so question the "*"s within the prototype of bsearch;
>i.e., it is hard to understand to what, and with what stopping point,
>your typing has tied x.
 
Huh?  I said, and you correctly quoted my saying, what x was:
>> Notice that the first parameter names the prototype-scoped identifier
>> x, whose type is invoked in other parts of this prototype. If the
>> programmer wanted to name other parameters and copy their types as
>> well, it could also be done.
  oftype(x) *bsearch(const any (*x)[], const oftype(x) *,
                             ----^----
In this example, x has type (const any *).  [Hmm, the oftype (or whatever)
construct will have to be given additional capability to remove "const"
when necessary.]
--
Norman Diamond       diamond@tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
Technical Details
Message-ID: <9012310654.AA03555@decpa.pa.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!tut.cis.ohio-state.edu!ucbvax!tkou02.enet.dec.com!diamond

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!tut.cis.ohio-state.edu!ucbvax!tkou02.enet.dec.com!diamond
From: diamond@tkou02.enet.dec.com ("diamond@tkovoa")
Newsgroups: comp.std.c++
Subject: Re: parameter type matching
Message-ID: <9012310654.AA03555@decpa.pa.dec.com>
Date: 31 Dec 90 06:54:08 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Lines: 40