Re: Two pointers to the same obejct, two differnet values...

From: Gianni Mariani (gi2nospam_at_mariani.ws)
Date: 12/18/03


Date: 18 Dec 2003 09:44:10 EST

Mattias Brändström wrote:
...
>
> The question is this: can I rely on this behaivour and expect to get
> differnt pointers on all platforms or are there some platforms that
> might give me the same pointer no matter on how I look at an object?

I don't think the standard mandates what the "integer" value of the
pointer should be. So I don't think you can rely on ANY behavior other
than the basic pointer arithmetic and implicit pointer conversions.

>
> I suspect that this is not portable behaivour and that it's completely
> undefined and compiler depandant. It would be nice to hear your comments.
>

exactly.



Relevant Pages

  • Re: Thou shalt have no other gods before the ANSI C standard
    ... Because of these two platforms ... > The C standard does allow memcpy of pointer objects. ... New compiler development for such platforms is not a poor economic ...
    (sci.crypt)
  • Re: Why does rewind() ignore errors?
    ... promise that memsetting any scalar to zero on their implementations ... YOU can assume that all-zero-bits is a valid null pointer ... platforms where it is true. ... The C standard allows C implementations to run programs on those rare ...
    (comp.std.c)
  • Re: OpenSSL Hacks
    ... possible on many platforms when a null pointer is used as though it ... to denial-of-service are a crucial security goal. ... If you found a honest-to-goodness exploitable security vulnerability, ...
    (sci.crypt)
  • Re: How much did the AS/400 influence the C standard?
    ... implementations that drop the minimalist flat memory model in favor ... implementor and convenience for the C programmer; ... performance on other platforms. ... In a segmented architecture, for example, pointer sub- ...
    (comp.std.c)
  • Re: decrement past beginning is valid?
    ... I'm just saying that it's legal from the ... > necessarily going to work on all conceivable platforms "without a ... that an array is the same as a pointer. ... Although subscripting out of the bounds of the array is undefined ...
    (alt.comp.lang.learn.c-cpp)