Incompatibility with VO on comparing a USUAL (assigned to NULL_*) against zero with the == and != operators
https://www.xsharp.eu/forum/private-product/3460-variables-comparison-with-0-evaluates-to-true-when-it-s-a-null-ptr#25940
See inline below for differences in behavior between X# and VO with comparing a usual against zero with the == and != operators.
I am not really sure if this insane behavior of VO should be emulated in X# or not, but fact is that it did bite an X# developer, his app was not working correctly after porting it to VO and the reason was the different behavior between X# and VO with testing a usual holding NULL_PTR against zero.
FUNCTION Start() AS INT
LOCAL u AS USUAL
u := NIL
? u == 0 // VO: FALSE X#: FALSE <same>
? u != 0 // VO: TRUE X#: TRUE <same>
?
u := NULL_PTR
? u == 0 // VO: TRUE X#: FALSE <same>
? u != 0 // VO: TRUE X#: TRUE <DIFFERENT>
?
u := NULL_SYMBOL
? u == 0 // VO: TRUE X#: Runtime Errror <DIFFERENT>
? u != 0 // VO: TRUE X#: Runtime Errror <DIFFERENT>
?
u := NULL_DATE
? u == 0 // VO: TRUE X#: Runtime Errror <DIFFERENT>
? u != 0 // VO: FALSE X#: Runtime Errror <DIFFERENT>
?
u := NULL_PSZ
//? u == 0 // VO: Runtime Error (operation not supported) X#: Runtime Errror <same>
//? u != 0 // VO: TRUE X#: Runtime Errror <DIFFERENT>
?
u := NULL_STRING
? u == 0 // VO: Runtime Error (operation not supported) X#: FALSE <DIFFERENT>
? u != 0 // VO: TRUE X#: TRUE <same>
RETURN 0
And if we do decide to emulate this, then maybe we will need to check VO's behavior also with other operators, like >, >= etc...