This is a discussion on Re: Two patches for lib/libc/db/hash/hash.c within the mailing.openbsd.tech forums, part of the OpenBSD category; --> On Sun, Apr 06, 2008 at 08:13:25PM -0600, Philip Guenther wrote: > On Sun, Apr 6, 2008 at 2:21 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On Sun, Apr 06, 2008 at 08:13:25PM -0600, Philip Guenther wrote: > On Sun, Apr 6, 2008 at 2:21 AM, patrick keshishian <sidster@boxsoft.com> wrote: > ... > > The first diff has nothing to do with the above problem. It is > > a sequence point evaluation fix. > ... > > rbufp->flags |= BUF_PIN; > > - for (bp = (u_int16_t *)rbufp->page, n = *bp++, ndx = 1; ndx < n > > + bp = (u_int16_t *)rbufp->page; > > + n = *bp++; > > + for (ndx = 1; ndx < n > > if (bp[1] >= REAL_KEY) { > > > Maybe I'm blind, but I don't see any sequence-point issues in the > original code there: the comma operator introduces a sequence-point > between the assignment to bp and the *bp++. I believe the order of evaluation is undefined and not portable. If this is incorrect, then, by all means ignore the first diff. What I'm going by is the following: ISO/IEC 9899:TC2 Committee Draft -- May 6, 2005 WG14/N1124 Annex C (informative) Sequence points The following are the sequence points described in 5.1.2.3: .... -- The end of a full expression: an initializer (6.7.8); the expression in an expression statement (6.8.3); the controlling expression of a selection statement (if or switch) (6.8.4); the controlling expression of a while or do statement (6.8.5); each of the expressions of a for statement (6.8.5.3); the expression in a return statement (6.8.6.4). |