On Tue, 2009-10-27 at 16:24 +0000, Gordon Allott wrote:
> Hi,
> 
> I'm trying to subclass a Clutter.Actor, which happens to have methods
> such as 
>   void (* allocate)             (ClutterActor           *actor,
>                                  const ClutterActorBox  *box,
>                                  ClutterAllocationFlags  flags);
> 
> Which is okay, apart from that it uses a const parameter, which as far
> as I can tell I have no way of defining in vala.
> 
> Would it not be worth allowing const parameters in method declarations
> even if all they do is indicate to the c translator that the parameter
> should be declared as const? or at the very least a CCode attribute
> would be handy. at the moment you will get a bunch of "assignment from
> incompatible pointer type" warnings from gcc, which if you are trying to
> develop clean code and have -Wall on, it makes it impossible to use
> valac in this situation.

valac will use const for this parameter if the struct is annotated as
[Immutable] in the bindings. If `const ClutterActorBox *` is used for
all (or most) input parameters in the C API, we should add the
[Immutable] attribute to the clutter bindings to get rid of the
warnings. Can you check/verify whether `const` is used consistently in
the case of ClutterActorBox input parameters?

Jürg

_______________________________________________
Vala-list mailing list
Vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to