[Gambas-bugtracker] Bug #1715: Have varptr() return the pointer to the data of a variant, instead of constanly coping the data to a fixed datatype

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Sat Jan 18 01:50:51 CET 2020


http://gambaswiki.org/bugtracker/edit?object=BUG.1715&from=L21haW4-

Brian G reported a new bug.

Summary
-------

Have varptr() return the pointer to the data of a variant, instead of constanly coping the data to a fixed datatype

Type             : Request
Priority         : Medium
Gambas version   : Master
Product          : Language


Description
-----------

Would it be possible to have the following work correctly

dim i as variant = 0
dim p as pointer

p = varptr(i)  ' have this return a pointer to underlying storage type memory

Using the data type of the variant, and return an error only for those which don't have a simple pointer, rather than the unexpected "wanted number error"

I guess not many people are using varptr() but it would save a lot of double copy because now we must

dim j as int
j = i
p = varptr(j)

I don't know if this is complicated


System information
------------------

OS linux




More information about the Bugtracker mailing list