Re: [Vala] Vala dealing with const paramaters
- From: Jürg Billeter <j bitron ch>
- To: gord allott canonical com
- Cc: vala-list <vala-list gnome org>
- Subject: Re: [Vala] Vala dealing with const paramaters
- Date: Tue, 27 Oct 2009 17:43:26 +0100
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]