Re: [PATCH] dir.c: avoid c99 array initialization
- From
Brandon Casey <casey@nrlssc.navy.mil>
- Date
- Aug 28, 2008, 16:45 UTC
- Message-ID
- <GwKOGVPR0AVw4_Phmw1TSNzzMDtafrawMMahm2DQwh44k6uTOHkjTQ@cipher.nrlssc.navy.mil>
- In-Reply-To
- <871w09kvew.fsf@lysator.liu.se>
David Kågedal wrote:
Show 14 quoted lines
> 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.
> 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. Demonstrated need is required.
But, saying that, I posted the patch you replied to in a series that was for informational purposes only (though I could have done a better job labeling them). There were no comments from anyone who said that the series solved any problems they were encountering. At some point I will post an update.
-brandon