Path: 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: <1990Nov12.194544.14504@Think.COM> <5N.6GH5@xds13.ferranti.com> Organization: IR Lines: 22 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