On Mon, Mar 7, 2016 at 1:49 AM, Jean-Philippe André <[email protected]> wrote:
> Hi Felipe
>
> On 7 March 2016 at 05:57, Felipe Magno de Almeida <
> [email protected]> wrote:
>
>> felipealmeida pushed a commit to branch master.
>>
>>
>> http://git.enlightenment.org/core/efl.git/commit/?id=d723990955289a5ca62605262f4bc4cd0aa8d25f
>>
>> commit d723990955289a5ca62605262f4bc4cd0aa8d25f
>> Author: Felipe Magno de Almeida <[email protected]>
>> Date: Sun Mar 6 17:24:34 2016 -0300
>>
>> eina: Add Eina_Iterator implementation for C-array
>>
>> This iterator is convenient when you already have a C-Array and you
>> need to pass this array to a function receiving an Eina_Iterator.
>>
>> int array[] = {1, 2, 3, 4};
>> int* array2[] = {&array[0], &array[1], &array[2], &array[3], NULL};
>>
>> Eina_Iterator* iterator = eina_carray_iterator_new((void**)array);
>>
>
> I guess this is a typo? You meant array2 here?
>
> Is it really necessary to have an array of pointers and NULL termination?
> Can't we pass in a step value and length? Maybe that would be another type
> of iterator actually?
>
> Just wondering...
It is a typo. You are correct.
This iterator is used mostly where T is already a pointer, like Ecore_Promise*.
So you have:
Ecore_Promise* promises[5] = {NULL, NULL, NULL, NULL, NULL};
do_something_async1(obj, &promises[0]);
do_something_async2(obj, &promises[1]);
do_something_async3(obj, &promises[2]);
do_something_async4(obj, &promises[3]);
eina_carray_iterator_new(promises);
Maybe we have a bad naming here, a step won't help here because
the value is already a pointer and is treated like that. We could have
both, one for T's and another for T*'s (the current one).
With the size, that's how it was when I first implemented, Cedric
asked me to change because he thought it was more convenient.
I'm neutral on this matter, both work OK. Maybe the size is more
explicit to understand, the user will see a size requested and
will know they need to pass a size, and not having to read the
docs to know they really need a NUL-terminated array.
[snip]
Regards,
--
Felipe Magno de Almeida
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://makebettercode.com/inteldaal-eval
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel