Unix Technical Forum

Re: Two patches for lib/libc/db/hash/hash.c

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 ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > mailing.openbsd.tech

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-07-2008, 08:36 AM
patrick keshishian
 
Posts: n/a
Default Re: Two patches for lib/libc/db/hash/hash.c

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).

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:15 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com