In the video, text_content is an empty cstring and control.text_content is null. If I test for their inequality, turns out it's false (which means they are equal), as you can see by the fact that the if body doesn't get executed (and if I print the condition with fmt.println() it says false). Why are they considered equal? What should I do if I want that case to be considered different, write a custom compare_cstrings() or is there a simpler way?
Plus, why does the debugger tell me that the condition is true?
#Differentiate between empty cstring and null
1 messages · Page 1 of 1 (latest)
That is indeed a bug that has been unnoticed for a very long time.
This should be a relatively easy thing to fix.
This is now fixed in the latest commit
Hey that was quick, thank you!
@weak girder was this happening because the only data in the cstring was the null terminator?
The problem was cstring("") == cstring(nil) was effectively becoming string(cstring("")) == string(cstring(nil))
So the conversion of a nil cstring to a string meant it was equivalent to string("")
Ok, what will be the expected behaviour now?