R
Richard Tobin
[/QUOTE]We know from the original post that the result is 1 without the casts
to char *. So unless sizeof(char *) is negative (an interesting idea)
the difference after casting will also be positive.
Not necessarily. Did you see Flash Gordon's post (Message ID:
<[email protected]>) when he ran it on a AIX 5.3
machine? It gave -1 as the answer. Two different platforms gives two
different answers, both compiled with gcc.
Read what I wrote. "We know from the original post that the result is
1". The original poster ran the program and that's what he got. I
then said "If the system the OP is using [has various properties]
....". I am describing what the OP's system will produce, not what
some other gcc system will produce.
As most of us here know, undefined behavior is undefined behavior:
anything can happen, any result is possible. It all depends on your
implementation, compiler, and platform.
That's why I spelt out various assumptions. Given those assumptions,
what I said is true.
-- Richard