Thanks for the comments.
On Saturday, May 24, 2014 8:04:37 PM UTC+10, Stack Machine wrote:
- Your parameter style in the <network> synopsis inconsistent. Sometimes you specify names, sometimes you don't.
Can you please be specific? I cannot spot any parameter names in the <network> synopsis.
- Why is to_string a member function? Shouldn't it be a free function like std::to_string for built-in types? If not, why not provide one that calls the member version - for symmetry?
As I've noted in a couple of other posts: there should be a precedent (and there isn't for you what you propose AFAIK), the current name is based on bitset, and I'm leaving it to the LWG to determine the preferred approach.
- The address_vX::broadcast(address_vX, address_vX) overloads look problematic to me, as the mask is represented as an address object. However, since not all addresses are valid host masks, it seems better to me to propose that function in a seperate proposal where we have a type that can represent subnet masks or subnets.
From a practical point of view I disagree. Netmasks are often represented as dotted decimal addresses, and I am aware of software that uses this notation to determine the broadcast address.
- Why is the function to_ulong named to_ulong? On my platform unsigned long is 64 bits. That doesn't make sense.
Saying "doesn't make sense" is an overstatement. An unsigned long is large enough to hold the value.
Really though, this proposal predates uint32_t and friends, and the name comes from std::bitset. It could probably renamed to to_uint32() and return uint_least32_t. As you still have to check for too-large values, I don't have a strong view either way.
- Is there no way to create a constexpr address from a string literal? :(
- Why does to_bytes return the bytes in network byte order?
It is the standard representation.
- What if I want them in host byte order?
If to_ulong (or whatever it ends up being called) doesn't meet your needs, maybe you would like to propose additional hton/ntoh overloads for byte ranges?
Thanks again.
Cheers,
Chris