[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Human readable sort
From: |
Jim Meyering |
Subject: |
Re: Human readable sort |
Date: |
Fri, 22 May 2009 10:19:37 +0200 |
Pádraig Brady wrote:
> Eric Blake wrote:
>> Pádraig Brady <P <at> draigBrady.com> writes:
...
>> +static int
>> +find_unit_order (const char *number)
>> +{
>> + static const char orders [UCHAR_LIM] = {
>> + ['K']=1, ['M']=2, ['G']=3, ['T']=4, ['P']=5, ['E']=6, ['Z']=7, ['Y']=8,
>> + ['k']=1,
>> + };
>>
>> This assumes more of C99 than we have previously required. Are we sure that
>> all compilers out there will support this syntax?
>
> Designated Initializers were a GNU C C89 extension.
> So I thought they were both elegant and not too new.
> I've not got access to older machines to test unfortunately.
Since we've been requiring declaration-after-statement support
for some time now, using a feature like the above should be safe.
I think it is worthwhile, too.
Re: Human readable sort, Giuseppe Scrivano, 2009/05/21