xHarbour Reference Documentation > Function Reference |
Tests if a parameter is passed by reference.
HB_IsByRef( @<variable> ) --> lIsByReference
The function returns .T. (true) if the variable <variable> is passed by reference, otherwise .F. (false) is returned.
Function HB_IsByRef() is used to test if a variable is passed by reference to a function, method or procedure. This requires to pass <variable> by reference to HB_IsByRef(). If <variable> is not passed by reference to HB_IsByRef(), a runtime error is raised.
See also: | HB_IsArray(), HB_IsBlock(), HB_IsDate(), HB_IsHash(), HB_IsLogical(), HB_IsMemo(), HB_IsNIL(), HB_IsNull(), HB_IsNumeric(), HB_IsObject(), HB_IsPointer(), HB_IsString(), Type(), Valtype() |
Category: | Debug functions , Logical functions , xHarbour extensions |
Source: | rtl\valtype.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates how to test if a variable is // passed by reference to a subroutine. PROCEDURE Main LOCAL cMsg := "Hello World" LOCAL dDate:= Date() Test( cMsg, @dDate ) RETURN PROCEDURE Test( p1, p2 ) ? "First parameter is " IF HB_IsByRef( @p1 ) ?? "passed by reference" ELSE ?? "not passed by reference" ENDIF ? "Second parameter is " IF HB_IsByRef( @p2 ) ?? "passed by reference" ELSE ?? "not passed by reference" ENDIF RETURN
http://www.xHarbour.com