From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117794 invoked by alias); 22 Dec 2016 20:19:44 -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 117624 invoked by uid 89); 22 Dec 2016 20:19:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Shell, drawback, cries, variable's 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; Thu, 22 Dec 2016 20:19:32 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 18B9980B20 for ; Thu, 22 Dec 2016 20:19:31 +0000 (UTC) Received: from [10.10.117.58] (ovpn-117-58.rdu2.redhat.com [10.10.117.58]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uBMKJU1A022306 for ; Thu, 22 Dec 2016 15:19:30 -0500 Subject: Re: ssize_t To: cygwin@cygwin.com References: <3cd8f4f9-2d22-6018-9f84-6a1312042997@redhat.com> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Message-ID: <1d9dcb7d-8d0a-2e07-0494-cdab900cc455@redhat.com> Date: Thu, 22 Dec 2016 20:19:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <3cd8f4f9-2d22-6018-9f84-6a1312042997@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vggerxNAEdaLwEUfd98Erw3PNeD6GxEmg" X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg00252.txt.bz2 --vggerxNAEdaLwEUfd98Erw3PNeD6GxEmg Content-Type: multipart/mixed; boundary="PWM2MTwsqnkHfODa2nFvPv3PmHQ8KplWm"; protected-headers="v1" From: Eric Blake To: cygwin@cygwin.com Message-ID: <1d9dcb7d-8d0a-2e07-0494-cdab900cc455@redhat.com> Subject: Re: ssize_t References: <3cd8f4f9-2d22-6018-9f84-6a1312042997@redhat.com> In-Reply-To: <3cd8f4f9-2d22-6018-9f84-6a1312042997@redhat.com> --PWM2MTwsqnkHfODa2nFvPv3PmHQ8KplWm Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 2809 On 12/22/2016 02:14 PM, Eric Blake wrote: >> ssize_t.c:115:22: error: expected expression before =E2=80=98)=E2=80=99 = token >> if (sizeof ((ssize_t))) >> ^ > That's probably SUPPOSED to happen. >=20 > Autoconf tests for type names by comparing: In fact, read the autoconf source code: http://git.sv.gnu.org/cgit/autoconf.git/tree/lib/autoconf/types.m4#n56 # _AC_CHECK_TYPE_NEW_BODY # ----------------------- # Shell function body for _AC_CHECK_TYPE_NEW. This macro implements the # former task of AC_CHECK_TYPE, with one big difference though: AC_CHECK_TYPE # used to grep in the headers, which, BTW, led to many problems until the # extended regular expression was correct and did not give false positives. # It turned out there are even portability issues with egrep... # # The most obvious way to check for a TYPE is just to compile a variable # definition: # # TYPE my_var; # # (TYPE being the second parameter to the shell function, hence $[]2 in m4). # Unfortunately this does not work for const qualified types in C++, where # you need an initializer. So you think of # # TYPE my_var =3D (TYPE) 0; # # Unfortunately, again, this is not valid for some C++ classes. # # Then you look for another scheme. For instance you think of declaring # a function which uses a parameter of type TYPE: # # int foo (TYPE param); # # but of course you soon realize this does not make it with K&R # compilers. And by no means do you want to use this: # # int foo (param) # TYPE param # { ; } # # since C++ would complain loudly. # # Don't even think of using a function return type, since K&R cries # there too. So you start thinking of declaring a *pointer* to this TYPE: # # TYPE *p; # # but you know fairly well that this is legal in C for aggregates which # are unknown (TYPE =3D struct does-not-exist). # # Then you think of using sizeof to make sure the TYPE is really # defined: # # sizeof (TYPE); # # That is great, but has one drawback: it succeeds when TYPE happens # to be a variable: you'd get the size of the variable's type. # Obviously, we must not accept a variable in place of a type name. # # So, to filter out the last possibility, we will require that this fail: # # sizeof ((TYPE)); # # This evokes a syntax error when TYPE is a type, but succeeds if TYPE # is actually a variable. # # Also note that we use # # if (sizeof (TYPE)) # # to `read' sizeof (to avoid warnings), while not depending on its type # (not necessarily size_t etc.). # # C++ disallows defining types inside `sizeof ()', but that's OK, # since we don't want to consider unnamed structs to be types for C++, # precisely because they don't work in cases like that. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --PWM2MTwsqnkHfODa2nFvPv3PmHQ8KplWm-- --vggerxNAEdaLwEUfd98Erw3PNeD6GxEmg 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/ iQEcBAEBCAAGBQJYXDVSAAoJEKeha0olJ0NqshoH/i+JxFgcC4mSZLQkbjFdkIQK WfYVvTD7PMuOgyI7uDrsK+N23ygcHrbQdFBvWLK+1yf+cPtzERFbCZ/R8wX8aZPA xn1hY0oevN5V/KKPrkdcLE3f0vnqqvlkdLesoXP7INDFBezph24tXiiPkvdtJerB jEk0tEjRhd5F2tdcPiq+DMPdAykAlKRKxjQcUX3kxXrW/t2DnEAiVzCXArbFB5S5 96uLp6gM/cLsY4i/exrH1yqV8GKdZBQmTsPrdXmVec5J/a0gaU2IqacaNwZh3HMV cdpVLFh1WmF3pEmMBFbqe2oQtz2TuqQhi0MqLaXmC5UK2fhm6BC8TEIFreN8x9s= =1rkS -----END PGP SIGNATURE----- --vggerxNAEdaLwEUfd98Erw3PNeD6GxEmg--