X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type; q=dns; s=default; b=gu2E Vc9pe0kZx2IGYaLpCZuDfj2klnhWEDGu0qn51xMqws99WcXe441OqOx/75lTiu0+ YOwzIZTVc0xV/9cqjmfcpXKGoROJ1y+IzpfDFtE+5NVJTzUlxuDRkbqpwqflQVU5 YnEidBQ7Dcbh2zUfmZ1y24uKlwPNvo5GlyKfU0o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type; s=default; bh=fUllSu4uCO skbXh0SxNy7kHjYPQ=; b=B/GGxDpSE7ZAtu+Dvt5Y480XyJBzTuyM/ZilYAgMTr +95AZ9skfc9MYuzxDZCbWgAKX+v7x2WUw5ELpUsfPpzrGbL564P4mslGp1l5ocye iL1rYnqQPCiJ9LsHv9bTkGO8xpY3zQSzky+YlS7zmL6/KECyR0SN/qMgf1b7m1/b U= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 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 AT redhat DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2DDAB61BA6 Subject: Re: free() and implicit conversion to a function pointer To: cygwin AT cygwin DOT com References: From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Message-ID: Date: Mon, 20 Mar 2017 13:43:24 -0500 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 --JMsNRCTaRDnMdDonfM5t1OfGvO1MsVjVl Content-Type: multipart/mixed; boundary="2ehJVrqOuQl0xsxvNmFjV6Cd0UWbdJUhX"; protected-headers="v1" From: Eric Blake To: cygwin AT cygwin DOT 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 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" -----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--