Boost logo

Boost :

From: Bob Bell (belvis_at_[hidden])
Date: 2005-04-15 13:19:19


Don G <dongryphon <at> yahoo.com> writes:
> > > * timeout constructors are inconsistent. One takes
> >
> > What about Bob Bell's suggestion of using double?
> > Would there be concerns about the overhead in all
> > of the double -> integer conversions necessary to
> > interface with the various OS-level APIs? Having
> > constructors from a few possible argument types
> > (e.g. double, int seconds + int <subseconds type
> > TBD>) seems to make sense.
>
> I like the multiple ctors approach. Is this roughly what you have in
> mind?
>
> timeout (uint_t seconds, uint_t micros);
> timeout (uint64_t microsecs);
> timeout (double seconds);

I don't have any strong opinions on the network library design, but since
I'm sort of involved due to my suggestion about using doubles, I want to
point out that a concern I have with multiple constructors is potential
for ambiguity:

   timeout t(100);

If there is an automatic conversion from int to unit64_t (whatever that
is), this would be ambiguous. Further, there's an ambiguity to the
reader: what is the intention of this definition: 100 seconds or 100
microseconds?

With a single constructor, both issues go away.

Bob


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk