Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-03-08 14:36:57

From: "Jonathan Turkanis" <technews_at_[hidden]>
> Caleb Epstein wrote:
> > On Mon, 7 Mar 2005 20:29:17 -0700, Jonathan Turkanis
> > <technews_at_[hidden]> > Here are the names I've thought of:
> >>
> >> good: good, is_good
> >> eof: eof, is_eof
> >> fail: fail, eagain, is_eagain, would_block, should_retry
> >
> > I like "good" and "eof" as they are familiar from "native" iostreams
> > and seem to map well to the asynchronous case. I think fail is
> > perhaps too strong in this context however, and eagain is too
> > "unix-y". My preference for this property would be "would_block".
> Thanks for your feedback. would_block is unix-y too, no?

I don't see how "would_block" can be construed as "unix-y" since
it merely indicates that the requested operation would have
blocked had it not returned that value.

As for the rest of the choices, I agree that you should keep
"good" and "eof," "fail" is awfully general, and I don't think it
is the called function's place to tell the caller to try again
(eliminating eagain, is_eagain, and should_retry). Thus, from
the given choices, I favor "would_block."

If you want it to read better in the source, you could make it,

   if (read(...) == would_have_blocked)

Other options would be:

        if (read(...) == unavailable)
        if (read(...) == not_now)
        if (read(...) == nothing_now)
        if (read(...) == maybe_later)

Still, "would_block" seems like the right choice:

  if (read(...) == would_block)

Rob Stewart                           stewart_at_[hidden]
Software Engineer           
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at, gregod at, cpdaniel at, john at