[Gambas-devel] GB_DECLARE_STATIC makes empty classes

Benoît Minisini gambas at ...1...
Mon Sep 22 16:10:32 CEST 2014


Le 22/09/2014 16:04, Tobias Boege a écrit :
> Hi Benoit,
>
> you told me recently to use GB_DECLARE_VIRTUAL instead of GB_DECLARE and
> GB_VIRTUAL_CLASS. There is a problem with the GB_NOT_CREATABLE() pendant
> of this: GB_DECLARE_STATIC sets the object size (2nd argument to GB_DECLARE)
> to zero which may not be appropriate for all non-instantiable classes, e.g.
> Stream in the interpreter whose class contains data but can not be created
> at will (i.e. using New). This sort of thing. Is this worth doing something
> about?
>
> Adding a second argument would break, according to grep, 17 places, so
> nothing which I couldn't fix along...
>
> Regards,
> Tobi
>

If your class is not static but not instanciable, you must not use 
GB_DECLARE_STATIC(), but GB_DECLARE() + GB_NOT_CREATABLE(). You use 
GB_DECLARE_VIRTUAL() for true virtual classes only, even if makes not a 
lot of difference with GB_DECLARE_STATIC() behind the curtain.

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list