🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #2052

Re: Answers, Chapter 1: TeX (was C's sins... and others)

#2052
From: Dan Bernstein
Date: Wed, 14 Nov 1990 05:20
22 lines
1495 bytes
In article <5N.6GH5@xds13.ferranti.com> peter@ficc.ferranti.com (Peter da Silva) writes:
> Would it have been such a bad thing to standardise a method of determining
> if two pointers pointed into the same object?

When I asked in comp.lang.c several months ago about whether there was
any portable way to see if p pointed within array a[n], the best answer
was to test p against a + i for each i. I remember a few people saying
that it wouldn't be hard to add a builtin to the language.

So what would a good syntax be? Q (as defined---I'm not sure how to add
this to q2c) has just in(p,a,n), and I haven't bothered to look for a
special syntax. Perhaps a ternary construct a <= p < a + n, just to
annoy the parser writers? p < q < r is true if p + i == q and q + j == r
for positive integers i and j where the additions are valid. Similarly
with <=.

> They did it for offsets in structures with OFFSET_OF.

Yep. It's certainly doable on Intel's cute li'l chips, as well as on
real computers.

---Dan
Technical Details
Message-ID: <4569:Nov1405:20:1490@kramden.acf.nyu.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd
References: <H1_6+7A@xds13.ferranti.com> <1990Nov12.194544.14504@Think.COM> <5N.6GH5@xds13.ferranti.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd
From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein)
Newsgroups: comp.lang.misc
Subject: Re: Answers, Chapter 1: TeX (was C's sins... and others)
Message-ID: <4569:Nov1405:20:1490@kramden.acf.nyu.edu>
Date: 14 Nov 90 05:20:14 GMT
References: <H1_6+7A@xds13.ferranti.com> <1990Nov12.194544.14504@Think.COM> <5N.6GH5@xds13.ferranti.com>
Organization: IR
Lines: 22