Skip to content

Conversation

treeform
Copy link
Contributor

Fixing: #7603

@Araq
Copy link
Member

Araq commented Apr 14, 2018

Will merge once the tests are green, it's correct.


proc cmpStrings(a, b: string): int {.asmNoStackFrame, compilerProc.} =
asm """
if (`a` == `b`) return 0;
Copy link
Member

Choose a reason for hiding this comment

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

This will not work for nil strings:

var a, b: string
echo cmp(a, b) # prints -1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right! Fixed.

@treeform
Copy link
Contributor Author

Also added tests.

@Araq Araq merged commit b98cd3b into nim-lang:devel Apr 15, 2018
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.

3 participants