🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4084

Re: Function-prototype scope: Why?

#4084
From: Michael Meissner
Date: Fri, 22 Sep 1995 16:11
48 lines
3016 bytes
In article <43qjdk$loj@caip.rutgers.edu> halasz@caip.rutgers.edu writes:

| 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.

Ummm, there are machines where pointers have different formats (I know, I wrote
a C compiler for one of them), however the PDP-11 definately is not one of
those machines.

Off the top of my head, some of the machines that do have different sized
pointers, or use different encodings include:

	Data General MV/Eclipse		(different encodings, same size)
	DEC-10				(different sizes of pointers)
	Prime computers			(different sizes of pointers)
	CDC 6600			(different sizes of pointers)

The Cray machine may also be such a machine (I know it is a word addressed
machine, I don't know whether the normal pointer format includes the byte
offset -- I think it does not).

| > 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.

Take it from me, implementing strict C on a word based machine is simple --
what is difficult is getting lots of net code to run on such a machine.  Users
are not typically interested in 'strict' C.

-- 
Michael Meissner, Cygnus Support (East Coast)
Suite 105, 48 Grove Street, Somerville, MA 02144, USA
meissner@cygnus.com,	617-629-3016 (office),	617-629-3010 (fax)
Technical Details
Message-ID: <MEISSNER.95Sep22121125@tiktok.cygnus.com>
Path: arc1-ca.pugleaf.net!cambridge-news.cygnus.com!meissner
References: <43cgmb$cec@news0.rain.rg.net> <43er80$458@caip.rutgers.edu> <43pdgk$b3i@rdsunx.crd.ge.com> <43qjdk$loj@caip.rutgers.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!cambridge-news.cygnus.com!meissner
From: meissner@cygnus.com (Michael Meissner)
Newsgroups: comp.std.c
Subject: Re: Function-prototype scope: Why?
Date: 22 Sep 1995 16:11:25 GMT
Organization: Cygnus Support
Message-ID: <MEISSNER.95Sep22121125@tiktok.cygnus.com>
References: <43cgmb$cec@news0.rain.rg.net> <43er80$458@caip.rutgers.edu>
 <43pdgk$b3i@rdsunx.crd.ge.com> <43qjdk$loj@caip.rutgers.edu>
NNTP-Posting-Host: tiktok.cygnus.com
In-reply-to: halasz@caip.rutgers.edu's message of 20 Sep 1995 22:41:56 -0400