From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52154 invoked by alias); 20 Mar 2017 18:43:27 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 52143 invoked by uid 89); 20 Mar 2017 18:43:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Eric X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Mar 2017 18:43:25 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2DDAB61BA6 for ; Mon, 20 Mar 2017 18:43:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2DDAB61BA6 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eblake@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2DDAB61BA6 Received: from [10.10.121.124] (ovpn-121-124.rdu2.redhat.com [10.10.121.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC00B1899F for ; Mon, 20 Mar 2017 18:43:25 +0000 (UTC) Subject: Re: free() and implicit conversion to a function pointer To: cygwin@cygwin.com References: From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Message-ID: Date: Mon, 20 Mar 2017 18:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JMsNRCTaRDnMdDonfM5t1OfGvO1MsVjVl" X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00215.txt.bz2 --JMsNRCTaRDnMdDonfM5t1OfGvO1MsVjVl Content-Type: multipart/mixed; boundary="2ehJVrqOuQl0xsxvNmFjV6Cd0UWbdJUhX"; protected-headers="v1" From: Eric Blake To: cygwin@cygwin.com Message-ID: Subject: Re: free() and implicit conversion to a function pointer References: In-Reply-To: --2ehJVrqOuQl0xsxvNmFjV6Cd0UWbdJUhX Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 876 On 03/16/2017 02:24 PM, Hans-Bernhard Br=C3=B6ker wrote: >=20 > 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). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --2ehJVrqOuQl0xsxvNmFjV6Cd0UWbdJUhX-- --JMsNRCTaRDnMdDonfM5t1OfGvO1MsVjVl Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-length: 604 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJY0CLMAAoJEKeha0olJ0NqG+4H/3gZSbR+fygvxig/UVBSy9IF W2jM17GlEec7/d306W2VemRYEnRL96D4X8gBXuK1aq/6KUj5t1J5gh37hjGoH1vo TOWxhAg8CVxX0n6s/W9zdokkhXDSCXyUYLcBW5nM6uH9Vo+32756+OEjmyZlZ3Cz BnPeNV+5kfPm2cUYkMEFQxOPZr5G5RrhTUlZuVGIvpo9hJ3hIvdm0n5qQ56ajblD vwIU7OTIC4uzBmU0o/lKTFUggBTHErJjRmyq8rCaVAhzN/85hrDOAj2roFSPPPOv 6ROyyT9Z9spu2mtflgQdwNxENqZau/29/QL09n3TfVod4hH4zoN+DfKayjgNqaI= =DgFv -----END PGP SIGNATURE----- --JMsNRCTaRDnMdDonfM5t1OfGvO1MsVjVl--