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: <2918@buengc.BU.EDU> Date: 19 May 89 18:08:41 GMT References: <406@skye.ed.ac.uk> <10276@smoke.BRL.MIL> <2890@buengc.BU.EDU> <334.nlhp3@oracle.nl> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.lang.c Organization: Boston Univ. Col. of Eng. Lines: 50 In article <334.nlhp3@oracle.nl> bengsig@oracle.nl (Bjorn Engsig) writes: >Pointer addition IS meaningless. >Let's take an example of a 3 bit machine >with only 0, 1, 2, ... , 7 as the only addresses. Let's also declare Urf. Do I gotta say it again? Yes. I wish I could say it in double- height, double-width, blinking, bold characters like I could if the entire world had vt220 terminals, but, alas... POINTERS ARE NOT MEMORY LOCATIONS. THAT'S A CHILDHOOD EXAMPLE FOR THE PASCAL-DEPROGRAMMED. GROW UP, C-LAND (obligatory smiley for to mitigate the tone of that: :-). Thanks.) Simplest example: you do pointer to int. The compiler gets smart and stores that particular int in an accumulator. Now, tell me the address, in octal big-endian... >>It's one heck of an optimization if, for some reason, the subtraction >>appears in a loop, and the addition does not. >No, it probably would not be. Since by the example above, it is seen >that you would not be able to represent the pointer sum in a single word. I can if it's not an overflow, and that's true of any form of computerized arithmetic, so no problem. What? Are you going to take away my double- precision multiplication just because it doesn't fit into a double? See the rampant codepostings on overflow detection. >In article <10276@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: >>>Other postings have explained why we don't think a reasonable, consistent >>>model for this feature is possible. >True. Irrelevant. I don't think a reasonable, consistent model for the universe is possible. Does it collapse around us, therefore? >BTW, what is the sum of the two 'pointers' earth *russia, *southamerica : >58 45' 22" north, 43 45' 45" east >and >23 47' 19" south, 95 13' 18" west what is the sum of 23 47' 19" south, 43 45' 45" east and 4 --Blair "And you do that _daily_ in C..."