2016-06-10 4:10 GMT+02:00 Jean-Philippe André <j...@videolan.org>:

> Hi,
>
>
> This is bu5hman's idea mostly, but I'd like to bring the question to the
> attention of everyone, as I had the same idea before.
>
> For simple structs (think Eina.Rectangle, and Efl.Gfx.Color), would it be
> acceptable to pass them by value instead of reference, in C?
> That is:
>
> Eina_Rectangle a = {1, 2, 3, 4};
> rect_set(obj, rect);
> Eina_Rectangle b = rect_get(obj);
>
> 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.

just my 2 cents


>
>
> --
> Jean-Philippe André
>
> ------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
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