🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4040

Re: Function-prototype scope: Why?

#4040
From: Glenn Ammons
Date: Tue, 19 Sep 1995 06:11
26 lines
1884 bytes
In article <43kb6s$ntr@news0.rain.rg.net> Paul Long <plong@perf.com> writes:

> kanze@gabi-soft.fr (J. Kanze) wrote:
> >I *think* that the rationale for disallowing defining new types in
> >function prototypes is that there is no way to use such types.
> 
> Right, that's my point.  Other than within the prototype, the new type
> cannot be referrenced. It's practically useless.

I have run into a situation where this construct was necessary.  I was
compiling rpcgen(from Sun's RPC) protocol descriptions into C code
that would be called by Visual Basic.  Because of the way VB works, I
needed to add several new types for each type declared in the protocol
files.  Since I didn't know how the user was naming his types, and
because I was constrained to providing at least a type of the same
name as in the protocol file, I had to define the new types in the
function prototypes.  I also generated VB "prototypes" for the new
functions which passed VB types which were declared outside of the new
functions.  I could do this because I didn't have to pass names
through literally in the VB code.

So this feature does occasionally come in useful.  Whether the
standard ought to cater to this admittedly strange and
system-dependent situation is another matter.

--glenn
Technical Details
Message-ID: <AMMONS.95Sep19011145@diamond-joe.cs.wisc.edu>
Path: arc1-ca.pugleaf.net!uwm.edu!daffy!uwvax!spool!ammons
References: <43cgmb$cec@news0.rain.rg.net> <43er80$458@caip.rutgers.edu> <43i723$j90@rdsunx.crd.ge.com> <43j9oo$62d@gabi.gabi-soft.fr> <43kb6s$ntr@news0.rain.rg.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!uwm.edu!daffy!uwvax!spool!ammons
From: ammons@diamond-joe.cs.wisc.edu (Glenn Ammons)
Newsgroups: comp.std.c
Subject: Re: Function-prototype scope: Why?
Date: 19 Sep 1995 06:11:45 GMT
Organization: CS Department, University of Wisconsin
Message-ID: <AMMONS.95Sep19011145@diamond-joe.cs.wisc.edu>
References: <43cgmb$cec@news0.rain.rg.net> <43er80$458@caip.rutgers.edu>
 <43i723$j90@rdsunx.crd.ge.com> <43j9oo$62d@gabi.gabi-soft.fr>
 <43kb6s$ntr@news0.rain.rg.net>
NNTP-Posting-Host: diamond-joe.cs.wisc.edu
In-reply-to: Paul Long's message of 18 Sep 1995 17:44:59 GMT