Show/Hide Toolbars

XSharp

Argument 'arg' may not be passed with the '@' prefix

 

You may not pass an argument with a @ prefix to a method or function that does not expect a REF or OUT parameter.

 

This may happen in code like this

 

FUNCTION Start() AS VOID
LOCAL n AS INT
n := 123
test(@n)
? n
 
PROCEDURE test(u AS USUAL)
? u
u := 345

If you really want to pass the address of the USUAL to the TEST function then you have to assign the address to a local variable first:

 

FUNCTION Start() AS VOID
LOCAL n AS INT
LOCAL p as PTR
n := 123
p := @n   // assign address to local of type ptr
test(p) // pass the pointer
? n
 
PROCEDURE test(u AS USUAL)
? u
u := 345