Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MU5mk-0000wN-Gt for mharc-grub-devel@gnu.org; Thu, 23 Jul 2009 17:25:06 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MU5mi-0000w7-Px for grub-devel@gnu.org; Thu, 23 Jul 2009 17:25:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MU5me-0000rx-5s for grub-devel@gnu.org; Thu, 23 Jul 2009 17:25:04 -0400 Received: from [199.232.76.173] (port=56603 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MU5me-0000rd-0F for grub-devel@gnu.org; Thu, 23 Jul 2009 17:25:00 -0400 Received: from mail-ew0-f228.google.com ([209.85.219.228]:37153) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MU5md-0004Vs-IF for grub-devel@gnu.org; Thu, 23 Jul 2009 17:24:59 -0400 Received: by ewy28 with SMTP id 28so353078ewy.42 for ; Thu, 23 Jul 2009 14:24:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:in-reply-to :references:content-type:date:message-id:mime-version:x-mailer; bh=UwGbNCxiKEdra1r8hzFxAHgvBMoQfjNO7KSOofj06Uk=; b=gTS7Lc1xmD3ttwl8mLeeacDP964tiRbZW42oImzEqshPxflcpFlYbCAsjTWRThwjxK 0qQpiSOvQ4D8EEiWKcmU1jfcJFo1+yN9nzFJ+HMg4x0T7B4oTAY3b3wvy3NXVsdPrWdg +NXeGPivnAsbPxATgxhH/ULPsWG3/oeFxajx4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:in-reply-to:references:content-type:date:message-id :mime-version:x-mailer; b=GTcxY9JXx0TiwaQ3U07ghlSvgxPdeGK1qSEK6K0gDetvH0TaC2u31hyShjrDqA5FQh CarQ7UD9FJK58FBImqlEigKUb7Qs903HD4WwzBj4EZLpcEvEfoeMzEowT1SLqYwregy8 mI5+cYiYMJufT+Y3o82tR6yAlsRq4EyByrPPE= Received: by 10.210.142.6 with SMTP id p6mr8791911ebd.76.1248384298292; Thu, 23 Jul 2009 14:24:58 -0700 (PDT) Received: from ?192.168.1.100? (89.141.11.145.dyn.user.ono.com [89.141.11.145]) by mx.google.com with ESMTPS id 10sm729589eyd.27.2009.07.23.14.24.56 (version=SSLv3 cipher=RC4-MD5); Thu, 23 Jul 2009 14:24:57 -0700 (PDT) From: Javier =?ISO-8859-1?Q?Mart=EDn?= To: The development of GRUB 2 In-Reply-To: References: <1248289850.10302.57.camel@accesodirecto.casa> <1248375298.4660.174.camel@accesodirecto.casa> <1248380168.2661.71.camel@mj> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-+jPwD7UcECH5negBt0l+" Date: Thu, 23 Jul 2009 23:25:00 +0200 Message-Id: <1248384300.4660.214.camel@accesodirecto.casa> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [RFC, PATCH] C99 format specifiers for fixed-length integer types X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jul 2009 21:25:05 -0000 --=-+jPwD7UcECH5negBt0l+ Content-Type: multipart/mixed; boundary="=-VWlR8B/60q+IaLJl7PG5" --=-VWlR8B/60q+IaLJl7PG5 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Well, I'll try to address you both at once... Let me say that seeing more messages arrive with fresh arguments as I tried to build a coherent response was distressing ;) -- Pavel, you are right. I recognize I've gone overboard trying to be the paladin of standards, and thus I'd like to withdraw most of the patch. The only part that is useful and might someday become necessary is that dealing with 64-bit integers. In particular, if and when mingw64 support is added, for the reasons stated before. You could argue that we could just use "long long" and its format specifiers for all 64-bit integers everywhere, since it has that length in all supported platforms. However, we have no guarantees this will continue to be so in the future even for our currently supported platforms, and GCC 5.0 might as well have a 128-bit "long long" (MIPS already has an uint128_t), so making printf extract 16 bytes with "%ll" and give it only 8 with an uint64_t argument could be the kind of fun that takes a programmer hours to debug. With the reduced version of the patch I'm putting forward, such a (hypothetical, indeed) change will only impact types.h, while otherwise many source files will need to be modified in a hunt for "%ll"s and their variations. We can consider "lower" types safe since the autopromotion rules will keep the compiler happy even if int becomes 64-bit. -- Vladimir, I've followed your advice and restored the names for the remaining macros in this new patch. I'm open to any compromise between the GRUB_ convention and the need for less verbosity, given that 64-bit numbers are used widely throughout the code base. Conventions are just ways to make the life of us coders easier, but, without showing disrespect for them, they are not dogma. We must be ready to shove them apart if they get in the way. Respect to the utility of the [U]INTn_C(x) macros, they append the required modifiers to make sure the compiler interprets x as an [u]intn_t constant. For example, UINT64_C(1) -> 1uL in my amd64 Ubuntu box, but 1uLL in my WinXP Pro x64 box with mingw64 gcc. I agree that adding them goes outside the scope of the announced "format specifiers", but one without the other is pretty much useless in most real use cases, as I noticed when trying to use my initial patch in real GRUB code. --=20 -- Lazy, Oblivious, Recurrent Disaster -- Habbit --=-VWlR8B/60q+IaLJl7PG5 Content-Disposition: attachment; filename="int64macros.patch" Content-Type: text/x-patch; name="int64macros.patch"; charset="UTF-8" Content-Transfer-Encoding: base64 SW5kZXg6IGluY2x1ZGUvZ3J1Yi90eXBlcy5oDQo9PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQotLS0gaW5jbHVkZS9ncnVi L3R5cGVzLmgJKHJldmlzaW9uIDI0NDApDQorKysgaW5jbHVkZS9ncnViL3R5cGVzLmgJKHdvcmtp bmcgY29weSkNCkBAIC02NCw4ICs2NCwxNCBAQA0KIHR5cGVkZWYgaW50CQkJZ3J1Yl9pbnQzMl90 Ow0KICNpZiBHUlVCX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VUxMKQ0KICNlbmRpZg0KIA0KIC8qIE1pc2MgdHlwZXMuICAqLw0K --=-VWlR8B/60q+IaLJl7PG5-- --=-+jPwD7UcECH5negBt0l+ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Esto es una parte de mensaje firmado digitalmente -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iQIcBAABAgAGBQJKaNUnAAoJEKSl+Fbdeo728qwP/Rc4a01CZcKCGceRuW1GEuaI HpXTHP4mDui8qjrWj/PMKZL/kZ90OZKhGaX51HHnu3VwEKKsNLy2df3NI+AXGtTH CbJwhX//qK524eKki32ZAl+EARqyqXvzLc5ycNeDg2KeLyt+AegU4JMDhRXlx13F JGuo7eZ/9PNcqVmwr7XgTnA+Uqawa9N0R0N/e6l3eibw9h/7MjnO6MvI9cpgFpeY lOe7uCj2cDojs7NytvB62g9b9JQh1I7ud9sc2rHrdri1AVkQkHSAZI7yMfpoMEVx +0MmZcul290IbMd4uRLO6eYvZmYRQUzGz5snYgknuX/B2o2kXLwUySlGeWALfhSH tSmqkkXFF4AapvMSbT+Z1b1a9A3O47m0xmaES4DeNiCRCDFUSIFOohzH9YQjlJaS GBC8Cwb1uIFqM1vumNQsF7j44j+eFa+vT/MmXHfwN+nQtp2H6rSX0t7CKxrYhoYP EKZWWP63KQ8cbyqmoebZj2duJb2c6PpEK89GQd3at/ip4g+KNVavwIdRTDP4ZxgX plke/8mLWCchTB+Z2biq2117ni/xOrWFYOEnNc3A/SZcNjXtgwWWLwG0bME8hSEk GF7j7v+iZbE8DPk4N5bF6YdcuQkkwRIqjgvfIHRakB+hU3KiA5yGMHN6CG8jmf55 6X+LSmN3M2g0pQTNnqrS =ImhK -----END PGP SIGNATURE----- --=-+jPwD7UcECH5negBt0l+--