Skip to content

Need typecast operator to (const sockaddr) for IPAddress#43

Closed
pprindeville wants to merge 42 commits intopocoproject:developfrom
pprindeville:develop
Closed

Need typecast operator to (const sockaddr) for IPAddress#43
pprindeville wants to merge 42 commits intopocoproject:developfrom
pprindeville:develop

Conversation

@pprindeville
Copy link
Copy Markdown
Contributor

There are some operations (like POSIX system calls, e.g. ioctl, setsockopt, etc) that require a sockaddr.

Having a cast operator to sockaddr would simplify setting up such operations.

…erfaces as one operation, then filter based on IP/UP status as a separate operation.
@ghost ghost assigned aleks-f Dec 26, 2012
@aleks-f
Copy link
Copy Markdown
Member

aleks-f commented Dec 26, 2012

What is the purpose of returning const value?

@pprindeville
Copy link
Copy Markdown
Contributor Author

As I remember, when returning a temporary object it needs to be returned as a const. Didn't we see a similar problem once before with the BinaryReader class?

@aleks-f
Copy link
Copy Markdown
Member

aleks-f commented Dec 26, 2012

Only if you are assigning temporary to non-const reference; compiler will tell you about it.

http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/

@pprindeville
Copy link
Copy Markdown
Contributor Author

Well, since it needs to be assigned to a const reference in that case, returning the temporary as a const wouldn't break anything and serves as a reminder that it's an ephemeral object.

Either way, it's fine. I'd prefer it as a const, but I'm not adamant about it.

@aleks-f
Copy link
Copy Markdown
Member

aleks-f commented Jan 12, 2013

there's too many commits in this pull request, closing

@aleks-f aleks-f closed this Jan 12, 2013
obiltschnig pushed a commit that referenced this pull request Jun 27, 2018
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

Successfully merging this pull request may close these issues.

2 participants