🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #908

Re: Relationship between C and C++

#908
From: Jack Campin
Date: Tue, 20 Mar 1990 15:56
31 lines
1961 bytes
robison@m.cs.uiuc.edu wrote:

> Why is pointer arithmetic denigrated so much?  The C-style pointer
> arithmetic seems to me to implement a fairly simple abstraction,
> roughly equivalent to ``a tape and a read/write head.''
> Most C implementations do not do bounds checking on pointers, 
> but I fail to see why pointer arithmetic is inherently evil.

> Can anyone clue me as to the basis for pointer paranoia?

Garbage collection, for one.  If you try to implement a BCPL-family
language on a machine/OS with garbage-collected object memory [i.e. a
storage model a bit more sophisticated than a Turing machine], you have
real problems identifying what objects are still being referenced when
pointers can be incremented.

Secondly, real machines are sufficiently different from the Turing tape
that the result of a pointer arithmetic operation is not merely wordsize-
dependent like normal computer "arithmetic", it's OS-dependent.  Or do C
fans think it's a good idea to have operator semantics vary with the host
segmentation scheme?

Thirdly, the aliasing it enables is a semantic mess.  If anyone claims
different, let's see your denotational model of ANSI C.

-- 
--  Jack Campin   Computing Science Department, Glasgow University, 17 Lilybank
Gardens, Glasgow G12 8QQ, Scotland   041 339 8855 x6044 work  041 556 1878 home
JANET: jack@cs.glasgow.ac.uk    BANG!net: via mcvax and ukc   FAX: 041 330 4913
INTERNET: via nsfnet-relay.ac.uk   BITNET: via UKACRL   UUCP: jack@glasgow.uucp
Technical Details
Message-ID: <4869@vanuata.cs.glasgow.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ukc!strath-cs!cs.glasgow.ac.uk!jack
References: <8432@hubcap.clemson.edu> <5200048@m.cs.uiuc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ukc!strath-cs!cs.glasgow.ac.uk!jack
From: jack@cs.glasgow.ac.uk (Jack Campin)
Newsgroups: comp.lang.misc
Subject: Re: Relationship between C and C++
Message-ID: <4869@vanuata.cs.glasgow.ac.uk>
Date: 20 Mar 90 15:56:08 GMT
References: <8432@hubcap.clemson.edu> <5200048@m.cs.uiuc.edu>
Reply-To: jack@cs.glasgow.ac.uk (Jack Campin)
Organization: COMANDOS Project, Glesga Yoonie, Unthank
Lines: 31