Re: [Vala] [Genie] array slices



في س، 22-05-2010 عند 06:38 -0400 ، كتب Arc Riley:
I'm migrating some C code to Genie and ran into a troubling limitation; the
following line of code does not seem to have an equivalent in Genie:

        session->wbuff = g_string_append_len(session->wbuff, str+sent,
len-sent);

What this means is "when you can't send all the data you'd like, append the
rest to our (known to be empty) GString buffer".

The key part here is "the rest" - getting a slice of an array, such as C's
array + value syntax (Incompatible operand) or Python's array[start:] syntax
(error: syntax error, expected `]' but got `:' with previous identifier).
A workaround: use pointers ;-) Yes, pointers should not be used too
often but they let you do (almost) anything C can do.
If you cast your array to char* you should be able to use the C syntax.


Array slicing works in Vala, so I guess the Genie parser hasn't been
updated for a while.

HTH,
Abderrahim




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]