From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=47391 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhPU2-00076W-CO for qemu-devel@nongnu.org; Mon, 24 Jan 2011 11:41:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhPU1-0003N0-2P for qemu-devel@nongnu.org; Mon, 24 Jan 2011 11:41:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:14666) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhPU0-0003Mk-Qi for qemu-devel@nongnu.org; Mon, 24 Jan 2011 11:41:37 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0OGfYZ2027743 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 24 Jan 2011 11:41:35 -0500 Message-ID: <4D3DABBD.5020706@redhat.com> Date: Mon, 24 Jan 2011 17:41:33 +0100 From: Jes Sorensen MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 4/4] strtosz(): Use suffix macros in switch() statement References: <1295883211-18288-1-git-send-email-Jes.Sorensen@redhat.com> <1295883211-18288-5-git-send-email-Jes.Sorensen@redhat.com> <4D3DA473.1070704@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, qemu-devel@nongnu.org On 01/24/11 17:39, Markus Armbruster wrote: >>>> + case STRTOSZ_DEFSUFFIX_TB: >>>> >>> mul = 1ULL << 40; >>>> >>> break; >>>> >>> default: >>> >> >>> >> Phony abstraction. And it leaks: code here assumes the >>> >> STRTOSZ_DEFSUFFIX_T* are all upper case. >> > >> > qemu_toupper() - whats the problem? > If a STRTOSZ_DEFSUFFIX_T? expands to a lower case character, its case > will not match any input. Right, so one has to be careful when adding new suffix constants. However given that we already have all the likely to be used ones for the near future, that isn't exactly a big issue. On the other hand forcing the use of the macros makes it less likely that someone specifies an unsupported constant by hitting 'y' instead of 't' or similar. Jes