[Gambas-user] Feature request: Make 'Pointer' a true integer type

Bruno Félix Rezende Ribeiro oitofelix at ...181...
Sun Apr 27 10:14:24 CEST 2014


Hello again!

It'd be very handy if 'Pointer' was considered by the interpreter as an
integer data type like 'Byte', 'Short', 'Integer' and 'Long'. That way
one could use any integer function indiscriminately on a Pointer as
well, rather than converting it to 'Long' (using 'CLong' function)
every time it's an argument for an integer function.  That is specially
relevant when interfacing with external C libraries, where to make
portable Gambas programs one need to treat the C data type 'long' as
the Gambas data type 'Pointer'.  This means that 'Pointer' isn't
meaningful only in pointer contexts but also in ordinary integer
contexts.  What do you think about this proposed change?  Is there any
way in which it can be harmful to existing code or interpreter's
functionality?

Thanks in advance.

Ps: In order to make portable Gambas programs which interface with
external C libraries, one needs to follow the correct equivalence
between C and Gambas integer data types, which is given by the table:

[C]		[Gambas]
char		Byte
short		Short
int		Integer
long		Pointer
void *		Pointer
long long	Long

However, the Gambas Wiki page [1], besides having an incomplete table
which does not address 'char', 'short' and 'long long', says that the
equivalent of C's 'long' is Gambas' 'Long', what is only true on some
64-bit architectures.

Footnotes:

[1] http://gambaswiki.org/wiki/howto/extern

-- 
 ,= ,-_-. =.  Bruno Félix Rezende Ribeiro (oitofelix) [0x28D618AF]
((_/)o o(\_)) There is no system but GNU;
 `-'(. .)`-'  GNU Linux-Libre is one of its official kernels;
     \_/      All software must be free as in freedom;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20140427/83e072fa/attachment.sig>


More information about the User mailing list