On Fri, 2010-11-19 at 19:58 +0100, Jaroslav Smid wrote:
> Well, U suffix works, but I thought vala would be smart enough to handle
> this. Anyway, I had to switch to C because vala doesn't use size_t for array
> sizes and uses int.

public void foo ([CCode (array_length_type = "size_t")] int[] bar);

Generally array_length_type is used for bindings... if you just need to
use a C library which uses size_t you can just do something like the
above in your vapi and it will work perfectly. Lots of bindings use this
since the type used for the array length in C is so inconsistent (often
even within the same library).

If you want libraries you write in Vala to expose size_t as the array
length parameter, you can still do it but you will occasionally have to
work around issues caused by Vala thinking the variable is an int
(although it will be generated as size_t). That wouldn't be too
difficult, though... certainly less work than writing everything in C.

> 
> pancake: sorry for sending messed up message :-)
> 
> On Thu, Nov 18, 2010 at 10:53 PM, pancake <[email protected]> wrote:
> 
> > Vala should handle this correctly. The type is uint32 and not int32
> >
> > On 18/11/2010, at 15:31, Xavier Bestel <[email protected]> wrote:
> >
> > > Hi,
> > >
> > > On Thu, 2010-11-18 at 10:52 +0100, Jaroslav Smid wrote:
> > >> /home/jardik/Projects/DAOLinux/ErfEditor/Blowfish.vala:6.15-6.24: error:
> > >> Expected initializer of type `uint32' but got `int64'
> > >>        0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
> > >>                    ^^^^^^^^^^
> > >
> > > I think it's because this constant is too big to fit a signed int32, so
> > > it's a signed int64 => error.
> > > You should suffix it to explicitly tell it's unsigned to make it fit, I
> > > guess.
> > >
> > >       Xav
> > >
> > > _______________________________________________
> > > vala-list mailing list
> > > [email protected]
> > > http://mail.gnome.org/mailman/listinfo/vala-list
> > >
> >
> _______________________________________________
> vala-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/vala-list


_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to