-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[stdlib] Replace #elseif with #else for 64-bit platforms #14409
Conversation
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a clear readability win with no drawbacks. The tests remain easily greppable in case we add new archs later.
It may be a good idea to annotate all these #if
s with a standardized comment to indicate that the intention was to test for the width of a machine word.
:-( I'd push back against this. For low-level code, it's usually good to make explicit decisions about all new architectures. EDIT: until we have a dedicated check for whatever the real query is here. (Do ILP64 arches count? LLP64?) |
I agree with Jordan. Porting is hard. The String code in #14386 was able to use |
Fair enough! I agree a dedicated conditional would be much preferable. I think Swift's |
Yes, Int matches the size of a pointer. I just meant in general people aren't always clear about what they're actually testing for. (We had a bunch of |
What if we introduced a #if _pointerwidth(32)
return Int(Int32(bitPattern: rand32()))
#elseif _pointerwidth(64)
return Int(Int64(bitPattern: rand64()))
#else
fatalError("unimplemented")
#endif (We currently call this |
I'll close this PR in favor of continuing discussion on #14413. |
As discussed in #14386:
This PR removes the list of supported 64-bit architectures from non-test code in the standard library. (It'll be fine to continue testing only specifically enumerated architectures.)