To clarify, the tradition has been that if the initialization is direct
from a value, eg. "TYPE var = val" then this is permitted, but if it
requires a function call or a dereference then it is not. The idea in this
case is to prevent crashes during function entry.

On Tue, Feb 2, 2016 at 12:26 PM Cedric BAIL <[email protected]> wrote:

> On Feb 2, 2016 3:23 AM, "Tom Hacohen" <[email protected]> wrote:
> >
> > This makes the code significantly worse, why do this?
>
> Isn't that part of our coding style ? Sometimes I find top declaration not
> so great, like in this case. Sometime it feels better to group thing
> together as spreading declaration all over the place feel worse. Maybe we
> should allow just for declaration after function entry point check ?
>
> > On 01/02/16 11:40, Vincent Torri wrote:
> > > stefan pushed a commit to branch master.
> > >
> > >
>
> http://git.enlightenment.org/core/efl.git/commit/?id=cedeb0c45517b1661e3bff22dae09a307e9ec6cb
> > >
> > > commit cedeb0c45517b1661e3bff22dae09a307e9ec6cb
> > > Author: Vincent Torri <vincent dot torri at gmail dot com>
> > > Date:   Mon Feb 1 12:17:01 2016 +0100
> > >
> > >      Eina_Value: do not mix declarations and code
> > >
> > >      Reviewers: cedric, jpeg
> > >
> > >      Reviewed By: jpeg
> > >
> > >      Differential Revision: https://phab.enlightenment.org/D3624
> > > ---
> > >   src/lib/eina/eina_inline_value.x | 8 ++++++--
> > >   1 file changed, 6 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/src/lib/eina/eina_inline_value.x
> b/src/lib/eina/eina_inline_value.x
> > > index 3117f73..649e1de 100644
> > > --- a/src/lib/eina/eina_inline_value.x
> > > +++ b/src/lib/eina/eina_inline_value.x
> > > @@ -1679,10 +1679,12 @@ typedef struct _Eina_Value_Optional_Inner
> Eina_Value_Optional_Inner;
> > >   static inline Eina_Bool
> > >   eina_value_optional_empty_is(const Eina_Value *value, Eina_Bool
> *is_empty)
> > >   {
> > > +   void *mem;
> > > +
> > >      EINA_VALUE_TYPE_OPTIONAL_CHECK_RETURN_VAL(value, EINA_FALSE);
> > >      EINA_SAFETY_ON_NULL_RETURN_VAL(is_empty, EINA_FALSE);
> > >
> > > -   void *mem = eina_value_memory_get(value);
> > > +   mem = eina_value_memory_get(value);
> > >      if (!mem)
> > >        return EINA_FALSE;
> > >      if(2*sizeof(void*) <= sizeof(Eina_Value_Union))
> > > @@ -1700,9 +1702,11 @@ eina_value_optional_empty_is(const Eina_Value
> *value, Eina_Bool *is_empty)
> > >   static inline const Eina_Value_Type *
> > >   eina_value_optional_type_get(Eina_Value *value)
> > >   {
> > > +   void *mem;
> > > +
> > >      EINA_VALUE_TYPE_OPTIONAL_CHECK_RETURN_VAL(value, (const
> Eina_Value_Type *)NULL);
> > >
> > > -   void *mem = eina_value_memory_get(value);
> > > +   mem = eina_value_memory_get(value);
> > >      if (!mem)
> > >        return NULL;
> > >
> > >
> >
> >
> >
>
> ------------------------------------------------------------------------------
> > Site24x7 APM Insight: Get Deep Visibility into Application Performance
> > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> > Monitor end-to-end web transactions and take corrective actions now
> > Troubleshoot faster and improve end-user experience. Signup Now!
> > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> > _______________________________________________
> > enlightenment-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> _______________________________________________
> enlightenment-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to