Skip to content

Conversation

@CyberShadow
Copy link
Member

In particular, send/receive weren't @nogc.

@JackStouffer
Copy link
Contributor

LGTM other than the 32 bit issues.

* returns immediately and the connection attempt is still in progress.
*/
void connect(Address to) @trusted
void connect(Address to) @trusted const
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does const on a void method make sense?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes? It means that the object itself will not be modified.

A different question would be, does const on a method that mutates the state of what it is representing (OS socket) make sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const applies to this pointer so obviously yes

@CyberShadow
Copy link
Member Author

Gahhh. So send can't be @nogc because it does a "safe" conversion of size_t to int on Windows?

I think this is a case where it should be turned into a cast. No one is going to send 2GB of data via a socket in one go on Windows, right?

@DmitryOlshansky
Copy link
Member

I think this is a case where it should be turned into a cast. No one is going to send 2GB of data via a socket in one go on Windows, right?

Me thinks yes

@CyberShadow
Copy link
Member Author

Oh, as it turns out that's not even necessary because send doesn't guarantee that it sends everything, and returns the number of bytes sent.

@CyberShadow CyberShadow force-pushed the pull-20160430-213850 branch from 8b25a15 to 4cbaa55 Compare May 1, 2016 07:51
@DmitryOlshansky
Copy link
Member

Auto-merge toggled on

@CyberShadow CyberShadow force-pushed the pull-20160430-213850 branch from 4cbaa55 to ebb379f Compare May 1, 2016 12:02
@DmitryOlshansky DmitryOlshansky merged commit 1e9fdc0 into dlang:master May 1, 2016
*/
enum int ERROR = _SOCKET_ERROR;

private static int capToInt(size_t size) nothrow @nogc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@safe pure?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@safe is implicit (declared at the top of the module). pure makes no difference here because it is a private method called only by non-pure methods.

@CyberShadow
Copy link
Member Author

CyberShadow commented Oct 13, 2016

This pull request introduced a regression:
https://issues.dlang.org/show_bug.cgi?id=16514

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.

4 participants