-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
std.mem.eql: make comparisons for zero-sized and non-sized types work #19968
base: master
Are you sure you want to change the base?
Conversation
Maybe a bit of a strange idea, but what if the Undefined case returned, "undefined"? std.mem.eql compares the contents of two slices for equality, and equating Undefined is impossible imo. Either "undefined" or false. |
Well if A bit related to #15909 |
This is what I disagree with. There might be some existing precedent that supports the argument that untyped undefined is equal to another untyped undefined, but I don’t know if it. I agree it probably would be best we just don’t support that. |
I don't see a value in this particular function. |
My 2c after thinking about this for a bit:
|
Me neither but the commit description is now outdated and
I'm going to wait for a decision from a core team member here before making any changes.
Well in the case of Again, going to wait for a core team member's decision here. |
I guess I view the tests as also living documentation of expected/intended behavior. |
The `if (@sizeof(T) == 0) return true;` check simply doesn't work for a number of cases so that is removed and changed into `@sizeOf(T) != 0` and then used in the `eqlBytes` check chain to make comparing `enum{}`s possible. The rest special-cases for comptime-only types and undefined to make those comparisons possible as well. Fixes ziglang#19929
* some kinds of types require comptime calls to eql * don't rely on compare equal for undefined
Fixes #19929