|
Boost : |
From: Chris Cleeland (cleeland_at_[hidden])
Date: 2006-01-06 10:58:07
On Fri, 6 Jan 2006, Pedro Lamarão wrote:
> Chris Cleeland wrote:
> >>
> >>I suppose you meant four unsigned shorts?
> >
> > An IPv4 address is comprised of four octets, and an unsigned char
> > sufficiently represents an octet. A short would be overkill, no?
>
> I see, you meant an implicit conversion to char?
Whatever is necessary. If the args were shorts (signed or unsigned), the
interface is representing that the following would be legal:
asio::ipv4::address my_address(322, 798, 0, 1024);
And we know that's not correct. If the caller trusts implicit conversions
rather than explicitly passing unsigned chars, then that's their problem.
> I still fail to see a use case for this.
> Help me here. :)
I can't help you with that, as I did not originate the suggestion. The only
thing I can conjure in my mind is when parsing a string representation of an
address, particularly a dotted-decimal representation. Typically this sort
of stuff is handled by functions like inet_aton, but I can see where one
might prefer to not rely on external, non-standard functions like that.
-- Chris Cleeland, cleeland_c @ ociweb.com, http://www.milodesigns.com/~chris Principal Software Engineer, Object Computing, Inc., +1 314 579 0066 Support Me Supporting Cancer Survivors in Ride for the Roses 2005 >>>>>>>>> Donate at http://www.milodesigns.com/donate <<<<<<<<<
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk