[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: prepare vasnprintf for Unicode strings
From: |
Bruno Haible |
Subject: |
Re: prepare vasnprintf for Unicode strings |
Date: |
Wed, 13 Jun 2007 01:13:39 +0200 |
User-agent: |
KMail/1.5.4 |
Paul Eggert wrote:
> So, instead of this:
>
> if (flags >= 16)
> type = TYPE_U32_STRING;
> else if (flags >= 8)
> type = TYPE_U16_STRING;
> else
> type = TYPE_U8_STRING;
>
> I might use something like the following, say.
>
> type = (flags < 8 ? TYPE_U8_STRING
> : flags < 16 ? TYPE_U16_STRING
> : TYPE_U32_STRING);
Sorry, but this is less understandable. There is a semantic relation
between the 16 (= 'll') and TYPE_U32_STRING; and a semantic relation
between the 8 (= 'l') and TYPE_U16_STRING. The way you write the expression,
the things which are closely related are far apart in the code.
Bruno
Re: prepare vasnprintf for Unicode strings, Daniel Jacobowitz, 2007/06/11