>>>Just encountered a bug in our software releated to the use of = when set exact is set to off.
>>>
>>>I Know I should be using == in those cases where comparing strings of different lenght, but just a small test made me wonder.
>>>
>>>Is there any reason I should not use == for any comparison in VFP? It seems to work for any datatype.
>>>
>>>Is there any gotcha using == as a standard?
>>>
>>>
>>>Walter,
>>
>>Not that I am aware of, I know people who do that all the time in order to differentiate assignments from comparisons.
>
>Which I find a good argument in itself. I just wonder why it has taken me more thaw 20 years to draw that conclusion.
It's definitely safer to use == where you need to rely on an exact comparison.
My understanding is == is a little slower than =, and there can be speed/Rushmore optimization issues with indexes e.g. if you have a column MyCharCol that is indexed, and you have WHERE MyCharCol == "SomeValue" ... in a SELECT, ISTR it's not fully optimizable.
So, safer but a little slower.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up