[Gambas-bugtracker] Bug #1720: VarPtr does not return the correct values for class Variables

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Sat Feb 1 20:18:16 CET 2020


Comment #5 by Benoît MINISINI:

I'm currently thinking that I should go back with VarPtr():

1) Forbid it on string local variables, because a local string is internally a pointer and an offset to that pointer, and you can't return the address of two values.

2) Keep the fix on local variants, so that VarPtr() still returns the pointer to the variant value..

3) Keep the current behaviour of VarPtr() on global variables, where it returns the address in memory where the value is stored. Global strings being just a pointer, you don't have the problem you have with local strings. Just beware that VarPtr() returns a pointer to a pointer that points at string contents ("char **" in C).

4) Fix behaviour of VarPtr() on global variants, so that it returns a pointer to the variant value, not the full variant (which is the variant value and a datatype).

More information about the Bugtracker mailing list