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

Unified the use of character and string sequences. #127

Merged
merged 1 commit into from
Dec 5, 2015
Merged

Unified the use of character and string sequences. #127

merged 1 commit into from
Dec 5, 2015

Conversation

Nirma
Copy link
Contributor

@Nirma Nirma commented Dec 4, 2015

Thought this makes the intent a little clearer and makes the code read a little easier.

@cwillmor
Copy link
Contributor

cwillmor commented Dec 4, 2015

Is there any strong reason to go one way or the other? Expressions of the form foo << 'a' and foo << "a" are both pretty common in the Swift codebase (904 and 880 instances, respectively).

@Nirma
Copy link
Contributor Author

Nirma commented Dec 4, 2015

@cwillmor Either way will work, but I was just thinking in terms of readability and making syntax usage uniform.
If the code is going to use single quote literals in one place and single characters written as double quote literals in another place its better perhaps to use one convention or the other for single characters.

@jckarter
Copy link
Contributor

jckarter commented Dec 4, 2015

Printing a char is theoretically cheaper than printing a string, at least, though I imagine LLVM optimizes away the difference in many case.

@Nirma
Copy link
Contributor Author

Nirma commented Dec 5, 2015

@cwillmor @jckarter Thanks for commenting!
Would there be any drawback to doing this change?

lattner added a commit that referenced this pull request Dec 5, 2015
Unified the use of character and string sequences.
@lattner lattner merged commit 43e4741 into swiftlang:master Dec 5, 2015
@lattner
Copy link
Contributor

lattner commented Dec 5, 2015

This is a legit (nano) optimization, merged. Thanks!

dabelknap pushed a commit to dabelknap/swift that referenced this pull request Oct 23, 2018
slavapestov pushed a commit to slavapestov/swift that referenced this pull request Nov 27, 2018
maldahleh pushed a commit to maldahleh/swift that referenced this pull request Oct 26, 2020
freak4pc pushed a commit to freak4pc/swift that referenced this pull request Sep 28, 2022
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