Article View: comp.lang.misc
Article #1822Re: Answers, Chapter 1: TeX (was C's sins... and others)
From: Michael Coffin
Date: Wed, 24 Oct 1990 14:47
Date: Wed, 24 Oct 1990 14:47
24 lines
1764 bytes
1764 bytes
In article <3681@lanl.gov> jlg@lanl.gov (Jim Giles) writes:
> ...
>What you are talking about here is the ANSI C (which is _very_ new)
>constraint on the validity of pointer _arithmetic_. This constraint
>merely says that comparing (or subtracting) pointers that currently
>point to within separately allocated objects is undefined. The same
>status occurs if you add (or subtract) integers to (or from) pointers
>so that the result leaves the bounds of a single allocated object.
These restrictions are not new. I quote from page 98 of "The C
Programming Language" by Kernighan and Ritchie, 1978:
"Any pointer can be meaningfully compared for equality or
inequality with NULL. But all bets are off if you do arithmetic
or comparisons with pointers pointing to different arrays. If
you're lucky, you'll get obvious nonsense on all machines. If
you're unlucky, your code will owrk on one machine but collapse
mysteriously on another."
---
Michael Coffin mhcoffin@watmsg.waterloo.edu
Dept. of Computer Science office: (519) 885-1211
University of Waterloo home: (519) 725-5516
Waterloo, Ontario, Canada N2L 3G1
Technical Details
Message-ID:
<1990Oct24.144732.12503@watmath.waterloo.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!nih-csl!lhc!ncifcrf!haven!aplcen!samsung!cs.utexas.edu!sun-barr!decwrl!bacchus.pa.dec.com!news.crl.dec.com!decvax.dec.com!watmath!watmsg!mhcoffinReferences:
<26726@megaron.cs.arizona.edu> <3681@lanl.gov>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!nih-csl!lhc!ncifcrf!haven!aplcen!samsung!cs.utexas.edu!sun-barr!decwrl!bacchus.pa.dec.com!news.crl.dec.com!decvax.dec.com!watmath!watmsg!mhcoffin From: mhcoffin@watmsg.uwaterloo.ca (Michael Coffin) Newsgroups: comp.lang.misc Subject: Re: Answers, Chapter 1: TeX (was C's sins... and others) Message-ID: <1990Oct24.144732.12503@watmath.waterloo.edu> Date: 24 Oct 90 14:47:32 GMT References: <26726@megaron.cs.arizona.edu> <3681@lanl.gov> Sender: daemon@watmath.waterloo.edu (Owner of Many System Processes) Organization: University of Waterloo Lines: 24