apparent bug in 7/26/06 version of 'tzload()'
Robert Elz
kre at munnari.OZ.AU
Fri Jul 28 07:56:47 UTC 2006
Date: Thu, 27 Jul 2006 14:22:24 -0400
From: "Olson, Arthur David \(NIH/NCI\) [E]" <olsona at dc37a.nci.nih.gov>
Message-ID: <B410D30A78C6404C9DABEA31B54A2813997ADE at nihcesmlbx10.nih.gov>
| Now if only C had an &&= operator...
Sometimes that would be useful, but it turns out, it would not be
needed here. What's more, now those inappropriate &= can be removed
as well - the "if" that is added assures us that sp->goback (and
sp->goahead of course) are true before those expressions are evaluated.
And of course, true && x is identical to x, so all you need in those
expressions is a simple assignment now.
I'd also add extra parentheses in the "if". Well, actually, I probably
wouldn't, but with the absurd pickiness (programmer protection, even when
neither wanted nor desired) of C compilers these days, it is probably a good
idea to make it be
if ((sp->goback = sp->goahead = (sp->timecnt > i))) {
And even perhaps insert a != 0 test, just to show that it really is intended.
Or, if you were willing to make it be a little different style, write it
as ...
sp->goback = sp->goahead = FALSE /* or 0 */ ;
if (sp->timecnt > i) {
sp->goback = sp->types[i] == sp->types[0] &&
differ_by_repeat(sp->ats[i], sp->ats[0]);
sp->goahead =
sp->types[sp->timecnt - 1] == sp->types[sp->timecnt - 1 - i] &&
differ_by_repeat(sp->ats[sp->timecnt - 1],
sp->ats[sp->timecnt - 1 - i]);
}
kre
More information about the tz
mailing list