|
From: | Jes Sorensen |
Subject: | Re: [Qemu-devel] [PATCH 4/4] strtosz(): Use suffix macros in switch() statement |
Date: | Mon, 24 Jan 2011 17:41:33 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Thunderbird/3.1.7 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |