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=lApT JEZS48Omqy+SS9KEuGa8khF6MMbdugFsMB74yeCYWaMTBnYGSV0UBjdfpL76mFwS /NDAnFSXazu5xUS9ZgB7l1enEwGGgCTNff9VdH7ayZTmtHWOVPNaerCCC3zAWw0m 4M94ciQbTS99OwOihwfc4mR6bXGVifaFJI2aWSU= 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=41HZu1TbzL EUPRsgcfexsFEAx4Q=; b=nkW13dgUJHjV3sp6Wkx44ABOwkh27vYc3+x3hQIKu3 w7YFMKNxAcy/H3KMci9CkqJkaWqCAyfuDqK/nSit2KWdqbEeGNKoZ5r0opUR0+NM OomeovLBL2fHIs5TYSfri2ztaZFjFqhqJPOW0BS7gtFxyztt9oCvfekUrYi/ixin 0= 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=-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 Subject: Re: ssize_t To: cygwin AT cygwin DOT com References: <3cd8f4f9-2d22-6018-9f84-6a1312042997 AT redhat DOT 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 14:19:29 -0600 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 --vggerxNAEdaLwEUfd98Erw3PNeD6GxEmg Content-Type: multipart/mixed; boundary="PWM2MTwsqnkHfODa2nFvPv3PmHQ8KplWm"; protected-headers="v1" From: Eric Blake To: cygwin AT cygwin DOT com Message-ID: <1d9dcb7d-8d0a-2e07-0494-cdab900cc455 AT redhat DOT com> Subject: Re: ssize_t References: <3cd8f4f9-2d22-6018-9f84-6a1312042997 AT redhat DOT com> In-Reply-To: <3cd8f4f9-2d22-6018-9f84-6a1312042997 AT redhat DOT com> --PWM2MTwsqnkHfODa2nFvPv3PmHQ8KplWm Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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" -----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--