Article View: comp.lang.misc
Article #28Pointers
From: Herman Rubin
Date: Mon, 02 Nov 1992 13:21
Date: Mon, 02 Nov 1992 13:21
39 lines
2622 bytes
2622 bytes
In article <1992Nov2.083810.1652@syacus.acus.oz.au> ian@syacus.acus.oz.au (Ian Joyner) writes:
>jch@rdg.dec.com (John Haxby) writes:
>>C's pointers are a pain in the neck sometimes.
>Great understatement :-) You simply don't need C style pointers in decent
>programming languages. Standard Algol 60 does not have pointers. However,
>I use pointers in Algol all the time, Unisys A Series extended Algol 60
>that is (the assembler for the machine.) These pointers are very different
>in nature to C pointers. They are mainly meant for scanning text and data
>strings. These are very useful for parsing, etc, and map into single
>machine instructions, so that you can accomplish quite complex block
>updates with editing in one instuction.
I disagree. It is not too usual that I think C has done anything fairly
well, but its general use of pointers (not the whole syntax, etc.) IS
fairly close to what I believe pointers should be. A C pointer contains
the address of something, and I may want this something to be the address
of an integer, the address of a float, the address of a subroutine, the
address of another pointer, the address of something which even may have
different uses at different times.
>They also differ from C pointers in that if you run off the end of the
>block you are pointing at, you get a fault immediately, as the hardware
>checks for this.
There is no way, at the present time, that hardware gives you such a fault
unless it is a memory page fault, at least on most machines. I have seen
compilers which put in such a software fault, but this adds quite a bit of
overhead to every load and store.
BTW, I have asked, in comp.arch, for a hardware instruction which reads
with an automatic fault, to speed up execution in situations in which
that could occur.
--
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
Phone: (317)494-6054
hrubin@pop.stat.purdue.edu (Internet, bitnet)
{purdue,pur-ee}!pop.stat!hrubin(UUCP)
Technical Details
Message-ID:
<Bx3BsH.I0J@mentor.cc.purdue.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!ames!olivea!spool.mu.edu!umn.edu!news.cs.indiana.edu!noose.ecn.purdue.edu!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubinReferences:
<chl.720269838@cs.man.ac.uk> <1992Oct29.113733.3956@rdg.dec.com> <1992Nov2.083810.1652@syacus.acus.oz.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!ames!olivea!spool.mu.edu!umn.edu!news.cs.indiana.edu!noose.ecn.purdue.edu!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubin From: hrubin@pop.stat.purdue.edu (Herman Rubin) Newsgroups: comp.lang.misc Subject: Pointers Message-ID: <Bx3BsH.I0J@mentor.cc.purdue.edu> Date: 2 Nov 92 13:21:53 GMT References: <chl.720269838@cs.man.ac.uk> <1992Oct29.113733.3956@rdg.dec.com> <1992Nov2.083810.1652@syacus.acus.oz.au> Sender: news@mentor.cc.purdue.edu (USENET News) Organization: Purdue University Statistics Department Lines: 39