Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
So lately, I have been working with opening up files as binary then searching for specific information by hex. I came across something unusual and wanted to get addition opinions.
If I run this code in Windows, this statement is true. If I run the same code on a Mac, the statement is false.
I think there are two problems here. One is with Livecode and how it evaluates strings it determines are numeric values. I'm running openSUSE and the above evaluates to "not equal", however changing the test to "00020000" = "20000"' evaluates to "true" which is correct only if we are considering numeric values. The strings are clearly not identical, which is what the question is since they are quoted strings. This also occurs in OS X. The remaining question is why is the string being treated as a numeric in Windows. This is definitely something to pass along to the devs.
Though my personal preference is mac, my employer sees things differently Oh well, slowly but surely Microsoft is losing their market share
wsamples:
I agree; however, there is a 3rd element to the mix in which the string on the right contains the d character. I am curious if this character is being mistaken for 0 which would then follow suite to your conclusion.
if "00020000" = "20000d00" then
I will send an email to the dev team. Thank you everyone for their input.
- Rich
LiveCode 4.6.4
Dell Latitude E6400 running Windows XP SP3 / Mac Pro, Macbook Pro & Mac Mini running OS X 10.6.4
I was about to edit my post to clarify that I meant was talking about the string containing the "d" being treated as a numeric in Windows... Yes, it is really very odd and not possible to guess if that happens somehow in the Livecode engine or in Windows.
Some day I will learn to be thorough and efficient, but apparently I have a way to go...
The string containing the "d" is being truncated at the "d", which allows the statement to evaluate as true, based on the numeric value the string contains. This is NOT a good thing!