🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4066

Re: Function-prototype scope: Why?

#4066
From: halasz
Date: Thu, 21 Sep 1995 02:41
34 lines
2047 bytes
In article <43pdgk$b3i@rdsunx.crd.ge.com>, volpe@bart.crd.ge.com (Christopher R. Volpe) writes
> ....
> You have yet to give an example of why things would be bad if there were no
> such thing as function prototype scope (other than the parameter namespace
> collision problem I already pointed out).
I hav, but you ignord it.  Consider the PDP-11: pointer to 'char' and
pointer to 'int' need different-"shaped" pointers.  For generating
right argument-passing code for it, the compiler needs to know which it
is.  A 'struct' with one field a compiler is free in code to treat as
if it were onlie that which it contains.  Prototype-scope is a solution
by forbidding calling a so declared function.

> Nor have you responded to my point
> that compilers generated code just fine when there were no such thing as
> prototypes at all, let alone prototype-scope.
C was implemented onlie on byte-addressd machines?  I am quite sure that
that was so.  But the real answer is that the compiler was not required
to match argument and parameter.  If the programmer goofd and passd
byte-pointer to word-pointer or converslie, the compiler nevver would know.
Even with byte-addressd processors the like can be, if the processor
requires alignment and pointer of lesser alignment is passd: Bus error.

All the same, I doubt my explanation, for there are quite a few hacks that
go around it.  This one was posted,
	struct S;
	int k(struct S *);
and I hav uzed this,
	typedef struct S junkName;
	int k(struct S *);
.  Nor explains this this,
	int k(struct S { char k; });
and the like.

I doubt that the thing servs anie real purpose.
Technical Details
Message-ID: <43qjdk$loj@caip.rutgers.edu>
Path: arc1-ca.pugleaf.net!caip.rutgers.edu!not-for-mail
References: <43cgmb$cec@news0.rain.rg.net> <43er80$458@caip.rutgers.edu> <43pdgk$b3i@rdsunx.crd.ge.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!caip.rutgers.edu!not-for-mail
From: halasz@caip.rutgers.edu
Newsgroups: comp.std.c
Subject: Re: Function-prototype scope: Why?
Date: 20 Sep 1995 22:41:56 -0400
Organization: Rutgers University
Message-ID: <43qjdk$loj@caip.rutgers.edu>
References: <43cgmb$cec@news0.rain.rg.net> <43er80$458@caip.rutgers.edu> <43pdgk$b3i@rdsunx.crd.ge.com>
NNTP-Posting-Host: caip.rutgers.edu