which compiles fine in VO because a DOT can never be part of an identifier.
However in DotNet the Dot may be used as a namespace delimiter or between a type and a field/property, so there has to be at least a space in front of the .OR.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
FUNCTION tDBSetOrder(uOrder := NIL AS USUAL, cBagName := "" AS STRING) AS LOGIC PASCAL
LOCAL pszOrder AS STRING
RETURN VODBOrdSetFocus(cBagName, uOrder, @pszOrder)
FUNCTION tOrdListAdd(cOrdBag AS STRING, uOrder := NIL AS USUAL) AS LOGIC PASCAL
LOCAL lOk AS LOGIC
#pragma warning disable XS0219
LOCAL pPrev AS STRING
#pragma warning restore XS0219
IF ( lOk := VODBOrdListAdd(cOrdBag, NIL) )
IF !IsNil(uOrder)
lOk := VODBOrdSetFocus(cOrdBag, uOrder, @pPrev)
ENDIF
ENDIF
IF !lOk
RETURN _tDoError(#ORDLISTADD)
ENDIF
RETURN TRUE
You did not do that and added the line to the body of the entity.
As a result of that the #pragma line has ended the function, and the compiler sees this now as
#pragma warning disable XS0219
FUNCTION tOrdListAdd(cOrdBag AS STRING, uOrder := NIL AS USUAL) AS LOGIC PASCAL
LOCAL lOk AS LOGIC
LOCAL pPrev AS STRING
IF ( lOk := VODBOrdListAdd(cOrdBag, NIL) )
IF !IsNil(uOrder)
lOk := VODBOrdSetFocus(cOrdBag, uOrder, @pPrev)
ENDIF
ENDIF
IF !lOk
RETURN _tDoError(#ORDLISTADD)
ENDIF
RETURN TRUE
#pragma warning restore XS0219
And then it compiles fine.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
In order to avoid completely disabling the warning for the entity, maybe refactor your code, so that the variable is used in a dummy call. Something like:
FUNCTION tDBSetOrder(uOrder := NIL AS USUAL, cBagName := "" AS STRING) AS LOGIC PASCAL
LOCAL pszOrder := NULL AS STRING
LOCAL lResult AS LOGIC
lResult := VODBOrdSetFocus(cBagName, uOrder, @pszOrder)
DummyCall(pszOrder)
RETURN lResult
and define somewhere in your library this DummyCall() function that is only used as a way to avoid the warning. Not too elegant, but will work.
Thanks! I'll probably do that.
For such cases, one of the features of the C# language, which I mentioned not so long ago in this forum, would be useful: passing an underscore as a parameter for OUT (and, possibly, REF).