When is a cast not a cast?
Blair P. Houghton
bph at buengc.BU.EDU
Sat May 20 04:08:41 AEST 1989
In article <334.nlhp3 at oracle.nl> bengsig at 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 at smoke.BRL.MIL> gwyn at 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..."
More information about the Comp.lang.c
mailing list