From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl3bl-0004gd-Sb for qemu-devel@nongnu.org; Mon, 25 Nov 2013 16:22:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vl3bf-0005k7-Hq for qemu-devel@nongnu.org; Mon, 25 Nov 2013 16:22:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32992) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vl3bf-0005jx-1J for qemu-devel@nongnu.org; Mon, 25 Nov 2013 16:22:11 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAPLMA6v018740 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 25 Nov 2013 16:22:10 -0500 Message-ID: <5293BF81.1060008@redhat.com> Date: Mon, 25 Nov 2013 14:22:09 -0700 From: Eric Blake MIME-Version: 1.0 References: <1385379990-32093-1-git-send-email-mst@redhat.com> <1385379990-32093-4-git-send-email-mst@redhat.com> <5293B215.4030108@redhat.com> <20131125203152.GB12689@redhat.com> <5293B517.8090108@redhat.com> <20131125205404.GF12689@redhat.com> <5293BDFC.1020208@redhat.com> In-Reply-To: <5293BDFC.1020208@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Bjdqsxoje0cJi1h1MmVgSm0gPqCjEUo0d" Subject: Re: [Qemu-devel] [PULL for-1.7 v2 3/6] acpi-build: fix build on glib < 2.22 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek , "Michael S. Tsirkin" Cc: Paolo Bonzini , Richard Henderson , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Bjdqsxoje0cJi1h1MmVgSm0gPqCjEUo0d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 11/25/2013 02:15 PM, Laszlo Ersek wrote: >>>>>> + char s[] =3D "XXXX"; >>>>> >>>>> char s[5]; >>>>> >>>>> Initializing it is a waste of time. And storage - the string literal occupies space in the binary image. >>> Then do something like >>> >>> char s[sizeof("XXXX")]; Not to mention we already have at least one example of that idiom: disas/cris.c: char temp[sizeof (".d [$r13=3D$r12-2147483648],$r10") * 2]= ; > (Admittedly, EXAMPLE 4 in 6.7.5.2 Array declarators, p10, is informativ= e > (not normative), and 6.7.5.2 Array declarators, p2, speaks about an > "identifier". We don't have an identifier for "XXXX", but I think we ca= n > still derive that static storage duration implies non-variable length > for the array that holds the string.) Yes, use of char s[sizeof("")] is a fairly common idiom in C programming, when you want to size the array large enough for it's worst-case contents without actually wasting initialization/storage to those contents. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Bjdqsxoje0cJi1h1MmVgSm0gPqCjEUo0d Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSk7+BAAoJEKeha0olJ0NqQmwH/Rgq92rlTEomg2TfKao0Y3Vc oMbEHLQt4d8vJH3b7A+Xze0klCNF/h8VgC3uVCTftC7bH5USJ0GrH9wj1W+bYT0+ lxdIN1OwlHBdie/rScKi3/W9ICoYERLT+7vggjpXDr/6FPPWqc+M10JFn4Bxzkz5 UbW3rLH+VRW/xBMec827sAN5PuNFDba57TxKMn4cLGkXNUW29APcp2KkHeMn7ngP Ugvg0MUgGdkWbMUivNykeTKDgkn3J9iuNKdTg9FHclYUpektNAIknOzM8W7Ro2iQ U7EO7UqOLmObkvmKyMs6nuByVeo65inS6geZE4gq1yvijN6DjpmuzF5eJhDqmDI= =DGUE -----END PGP SIGNATURE----- --Bjdqsxoje0cJi1h1MmVgSm0gPqCjEUo0d--