Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why return a default constructed ip address on failure? #75

Open
mclow opened this issue Mar 8, 2018 · 0 comments
Open

Why return a default constructed ip address on failure? #75

mclow opened this issue Mar 8, 2018 · 0 comments

Comments

@mclow
Copy link

mclow commented Mar 8, 2018

[internet.address.v4.creation]/6 says (about make_address_v4):

Returns: If successful, an address_v4 value corresponding to the string str. Otherwise address_v4().

What is the benefit for returning all zeros?
Why not just say something like "Otherwise, the return value is unspecified".

When I'm parsing these bits, if I get a failure, I have to either (1) zero the internal array, or (2) return a different value, which defeats some cases of RVO.
(Obviously, this is not specific to address_v4]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant