Re: [PATCH] dir.c: avoid c99 array initialization
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 28, 2008, 18:50 UTC
- Message-ID
- <7vhc95dldz.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <GwKOGVPR0AVw4_Phmw1TSNzzMDtafrawMMahm2DQwh44k6uTOHkjTQ@cipher.nrlssc.navy.mil>
Brandon Casey <casey@nrlssc.navy.mil> writes:
Show 23 quoted lines
> David Kågedal wrote:
>> Brandon Casey <casey@nrlssc.navy.mil> writes:
>>
>>> The following syntax:
>>>
>>> char foo[] = {
>>> [0] = 1,
>>> [7] = 2,
>>> [15] = 3
>>> };
>>>
>>> is a c99 construct which some compilers do not support even though they
>>> support other c99 constructs. Use an alternative.
>>
>> But the alternative is much worse.
>
> _Much_ worse? In what way?
>
> From an execution standpoint, I don't think any more work is performed.
> Probably exactly the same amount of work.
>
> From a readability standpoint, I think it is very nearly the same in
> this case. The whole function is only 17 lines.I do not think your patch deserves "much worse" comment.
Show 5 quoted lines
>> So how important is it to support non-C99 compilers? > > I think it is relative to the amount of effort it takes. If there is > a demonstrated need and a trivial work around, I think it is worth > it to support non-c99 compilers.
I do not mind taking this patch. While it would not hurt (because the code is readable with or without the change) to convert the trivial ones like this patch addresses, it would not help portability if there are more nontrivial dependance to c99 constructs in other places in the code. Are there known ones?