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

Fix enum type in std.socket to match the receiver type #7094

Merged
merged 2 commits into from
Jun 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ public:
private void addPerCall(string f, uint n, names...)(ulong[] values...)
{
import std.array : join;
enum uint mask = mixin("Options."~[names].join("|Options."));
enum ulong mask = mixin("Options."~[names].join("|Options."));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Assigning ulong to uint.

Copy link
Member

Choose a reason for hiding this comment

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

This is known at compile time, isn't it ? So it should not be a problem.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The idea is that if the user has forced a type upon an enum, it should always be taken into account.

Copy link
Member

Choose a reason for hiding this comment

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

That sounds like a very arbitrary limitation without apparent benefit.

static if (perCallFlags & mask)
{
// Per allocation info
Expand Down
2 changes: 1 addition & 1 deletion std/parallelism.d
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ struct Task(alias fun, Args...)
static if (isFunctionPointer!(_args[0]))
{
private enum bool isPure =
functionAttributes!(Args[0]) & FunctionAttribute.pure_;
(functionAttributes!(Args[0]) & FunctionAttribute.pure_) != 0;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Assigning uint to bool.

}
else
{
Expand Down
2 changes: 1 addition & 1 deletion std/socket.d
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ shared static ~this() @system nothrow @nogc
/**
* The communication domain used to resolve an address.
*/
enum AddressFamily: int
enum AddressFamily: ushort
{
UNSPEC = AF_UNSPEC, /// Unspecified address family
UNIX = AF_UNIX, /// Local communication
Expand Down