Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.lang.c Subject: Re: When is a cast not a cast? Message-ID: <2890@buengc.BU.EDU> Date: 17 May 89 12:34:51 GMT References: <2747@buengc.BU.EDU> <10191@smoke.BRL.MIL> <406@skye.ed.ac.uk> <10276@smoke.BRL.MIL> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.lang.c Organization: Boston Univ. Col. of Eng. Lines: 49 In article <10276@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: >In article <406@skye.ed.ac.uk> richard@aiai.UUCP (Richard Tobin) writes: >>>Addition of pointers is a meaningless operation. >>Not always. [char *t, *p, *q] >> t = p + q; > >But you haven't told us what this means! It means that you lose the argument, Doug. >What properties does t hypothetically have? It has the property that you can now subtract char *pnew, *r; pnew = t - r and expect pnew to point to the location referred to p that is the same offset as q is referred to r. It's one heck of an optimization if, for some reason, the subtraction appears in a loop, and the addition does not. >What is its type hypothetically supposed to be? char * >What can one legally do with it? What one can legally do between (consenting) integers? >(Apparently, subtracting r is legal? What are the official criteria?) Ask yer second-grade teacher, or get another career. >Other postings have explained why we don't think a reasonable, consistent >model for this feature is possible. "Why we don't think...possible"?? Not only is it possible, it's sensible. As to whether we think it is so, that is irrelevant. We don't think fusion is possible, either, unless we consider that it's going on all over the place (well, not _all_ over the place, but in all those jillions of stars...!) --Blair "Introducing N.O.C.W.A.P.: The National Organization of Code Writers for Addable Pointers."