I'm looking specifically at ip::basic_endpoint and ip::address, which can be constructed from existing values (in which case it's pretty clear what the object's state will be after construction) but also provide default constructors. While it's interesting to know that these classes have default constructors, the minimalist documentation "Default constructor." (example) leaves a lot of questions unanswered.
For ip::address, will the default constructor construct a special "nil" object or will it construct an actual IPv4 equivalent to "0.0.0.0" or IPv6 "::"? Will a default-constructed object return true for is_unspecified()? What kind of values does is_unspecified() deem as "unspecified" - nil, "0.0.0.0", "::", and/or all of them? Will a default-constructed object convert to a string successfully or throw an exception, or return an empty string? What sort of exception or error code value can I expect from to_string() when things go wrong?
For ip::endpoint, does it initialize with a default-constructed ip::address object or with a default IPv4/IPv6 address? Is the port initialized with 0 or left to random C++ default allocation? Am I supposed to check for an unspecified address when determining whether the endpoint has been initialized with a given value, should I include the port value in such a check or not rely on its value at all after default construction?
Some of these questions can be trivially answered by looking at the code, others require ploughing through macros defined by other macros nested in yet more macros. I should be able to answer all of them just by looking at the documentation. This is not the case today, I hope it can be fixed.
Thanks,
Jakob
I'm looking specifically at ip::basic_endpoint and ip::address, which can be constructed from existing values (in which case it's pretty clear what the object's state will be after construction) but also provide default constructors. While it's interesting to know that these classes have default constructors, the minimalist documentation "Default constructor." (example) leaves a lot of questions unanswered.
For ip::address, will the default constructor construct a special "nil" object or will it construct an actual IPv4 equivalent to "0.0.0.0" or IPv6 "::"? Will a default-constructed object return true for is_unspecified()? What kind of values does is_unspecified() deem as "unspecified" - nil, "0.0.0.0", "::", and/or all of them? Will a default-constructed object convert to a string successfully or throw an exception, or return an empty string? What sort of exception or error code value can I expect from to_string() when things go wrong?
For ip::endpoint, does it initialize with a default-constructed ip::address object or with a default IPv4/IPv6 address? Is the port initialized with 0 or left to random C++ default allocation? Am I supposed to check for an unspecified address when determining whether the endpoint has been initialized with a given value, should I include the port value in such a check or not rely on its value at all after default construction?
Some of these questions can be trivially answered by looking at the code, others require ploughing through macros defined by other macros nested in yet more macros. I should be able to answer all of them just by looking at the documentation. This is not the case today, I hope it can be fixed.
Thanks,
Jakob