:: Re: [DNG] Making sense of C pointer…
Top Page
Delete this message
Reply to this message
Author: Hendrik Boom
Date:  
To: dng
Subject: Re: [DNG] Making sense of C pointer syntax.
On Tue, Mar 29, 2016 at 02:46:50PM +0100, Rainer Weikusat wrote:

> This is a wrong assumption and it relies on behaviour the C standard
> doesn't guarantee. Any pointer may be converted (it's even converted
> automatically as required) to a void * and back and
>
> "the result shall compare equal to the original pointer"
>
> But a pointer to a void * is an entirely different animal and no such
> guarantees are made for that. This will work in practice if there's only
> one 'machine pointer type' anyway, though. But using it is not necessary
> as void * is sufficient.


Last time I looked at the C standard (which was a while ago, things may
have changed) function pointers were not guaranteed to be
interconvertable with data pointers. You could cast them back and
forth, but there was no guarantee they would survive the round trip.

-- hendrik