Am Dienstag, 2. September 2008 16:35:47 schrieb Benoit Minisini:
>
> The ByRef feature was mainly added to help people porting VB project.
>
> It does not work by passing pointers, but by keeping the value of the
> argument when the function ends, and put it into the expression passed
> ByRef.
>
>   GetData(ByRef sResult)
>
> does actually the following:
>
>   GetData(sResult) ' Push sResult on the stack as first argument.
>   ...              ' Do not free the stack after GetData ends.
>   sResult = ...    ' Gets the value from the stack and put it into sResult.
>
> Note that this way, any assignment expression can be passed by reference.
>
>   GetData(ByRef MyCollectionOfLabels["key"].Text)
>
> At function declaration, ByRef means that you *can* pass the argument by
> reference, but that you may not.
>
> At function call, ByRef means that you *want* the argument to be passe by
> reference.
>
> As Gambas linking is entirely dynamic, the interpreter checks at runtime
> that you use ByRef if the function really allows it. This is the reason why
> ByRef must be specified noth at function declaration and at function call.
>
> Moreover, you can see that ByRef makes the function call slower because of
> the needed checks and the recall of the value from the stack.

Message understood!!! :-)))
Thank you very much!

Greetz
Stevie


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to