On Fri, Jun 10, 2016 at 11:53 AM, Davide Andreoli
<d...@gurumeditation.it> wrote:
> 2016-06-10 15:18 GMT+02:00 Felipe Magno de Almeida <
> felipe.m.alme...@gmail.com>:
>
>> On Jun 10, 2016 1:55 AM, "Davide Andreoli" <d...@gurumeditation.it> wrote:

[snip]

>> > > Or even (non portable way, but applications could feel free to use
>> this):
>> > > rect_set(obj, (Eina_Rectangle){.w = 13, .h = 37});
>> > >
>> > >
>> > > I understand this could simplify some code.
>> > >
>> > >
>> > > My main problem with it is a concern about ABI compatibility. It seems
>> GCC
>> > > itself has various ways to pass structs by value. See:
>> > >
>> > >
>>
>> http://stackoverflow.com/questions/161788/are-there-any-downsides-to-passing-structs-by-value-in-c-rather-than-passing-a
>> > >
>> > >
>> > > Does anyone have real-life knowledge about this? How is it on Windows?
>> > > Any strong arguments in favor or against?
>> > >
>> >
>> > I'm against this changes for 2 main reason:
>> > 1. API coherence: if we use rect, color, and maybe pos in some api, then
>> we
>> > should use them
>> > in ALL the api that use rect, color, geom, etc... this will be a massive
>> > change.
>> > 2. Will make bindings a lot slower, for each function call we need to
>> > allocate the struct, fill with value
>> > provided by user and pass this struct to the C function.. and then free
>> it.
>> > All this for each function call.
>>
>> Why would bindings allocate and free? Why not just pass by value too? How
>> is that any different for bindings. By value is likely faster with small
>> structs if anything.
>>
>
> what do you mean by "pass by value" ? the "non portable way?

Both ways. The non-portable-way is not non-portable at all, it just
requires a C99 compiler, which we require anyway AFAIK.

However, even the naive way of allocating it on the stack
compiles both to exactly the same thing with GCC 6.11. Not
surprising since the second is just a temporary (which is
also allocated on the stack) so, semantically the only difference
is that one has a name and the other doesn't.

My only  concern would be ABI, since you can't add new
members to the struct without breaking ABI. That might
not be important for position, etc. But it might be for
color.

>> > just my 2 cents

Regards,
-- 
Felipe Magno de Almeida

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to