bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dfa.c:in_coll_range z/OS fixes


From: Jim Meyering
Subject: Re: dfa.c:in_coll_range z/OS fixes
Date: Tue, 06 Apr 2010 21:32:24 +0200

Paolo Bonzini wrote:

> On 04/06/2010 09:03 PM, Jim Meyering wrote:
>> I prefer to avoid even the semblance of dead stores
>> for the odd-numbered elements.  I've committed the following
>> change on a private-for-now "old-compilers" branch.
>> I'll see how much trouble it is to carry this one change
>> through the upcoming development.  If the branch survives and
>> grows, I may eventually publish it.
>>
>>  From 4aeebc7febb4ccd49ecffd0181159c0dd866642c Mon Sep 17 00:00:00 2001
>> From: Jim Meyering<address@hidden>
>> Date: Tue, 6 Apr 2010 20:59:10 +0200
>> Subject: [PATCH] avoid C99 auto initializer syntax
>>
>> * src/dfa.c (in_coll_range): Initialize explicitly.  For z/OS.
>> ---
>>   src/dfa.c |    8 +++++++-
>>   1 files changed, 7 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/dfa.c b/src/dfa.c
>> index ca32b66..ef878f2 100644
>> --- a/src/dfa.c
>> +++ b/src/dfa.c
>> @@ -375,7 +375,13 @@ static unsigned char const *buf_end;    /* reference to 
>> end in dfaexec().  */
>>   static int
>>   in_coll_range (char ch, char from, char to)
>>   {
>> -  char c[6] = { from, 0, ch, 0, to, 0 };
>> +  char c[6];
>> +  c[0] = from;
>> +  c[1] = 0;
>> +  c[2] = ch;
>> +  c[3] = 0;
>> +  c[4] = to;
>> +  c[5] = 0;
>>     return strcoll (&c[0],&c[2])<= 0&&  strcoll (&c[2],&c[4])<= 0;
>>   }
>
> FWIW, this change seems pretty innocuous.

I agree that it's borderline,
but it's the sharp side of the wedge.

The original is concise, quite portable, and slightly more
readable/maintainable.
Compilers like the one on z/OS won't be around forever
and it'd be a shame to dumb-down our code (probably forever)
to accommodate such old compilers used by so few people.

The appearance of code matters.
Since it seems we may end up carrying other, even less palatable
portability-related changes, we might as well keep this aside,
with them.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]