free() and implicit conversion to a function pointer

Eric Blake
Mon Mar 20 18:43:00 GMT 2017

On 03/16/2017 02:24 PM, Hans-Bernhard Bröker wrote:
> The reason this is wrong is that C by design treats data and functions
> as living in separate realms, i.e. its virtual machine has a Harvard
> architecture.  One of the consequences of this is that pointers to
> functions and pointers to data are incommensurable, i.e. any and all
> conversions or comparisons across this divide are wrong.  (void *) are
> compatible to all data pointers, but not to function pointers.

That's true of strict C99, but not true of POSIX (which adds the
additional requirements above-and-beyond C99 that NULL be equivalent to
((void*)0) and that any function pointer can be converted to void* and
back without loss of information, in part because of dlsym() and friends).

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Cygwin mailing list