← Back to team overview

dolfin team mailing list archive

Re: [Branch ~dolfin-core/dolfin/main] Rev 5731: Remove parts of pointer/reference interface in Form. Prefer shared_ptr interfaces instead.

 

On Sun, Mar 06, 2011 at 10:02:14PM +0100, Marie E. Rognes wrote:
> On 03/06/2011 09:30 PM, noreply@xxxxxxxxxxxxx wrote:
> >    if (parameters["max_dimension"].change_count()>  0
> >        &&  V.dim()>  max_dimension)
> >+  {
> >      return true;
> >-
> >-  // Otherwise, not done.
> >-  return false;
> >+  }
> >+  else
> >+    return false;
> >  }
>
>
> I notice that my early returns keep getting moved into else
> clauses... I find this approach less readable, especially when there
> are nested ifs. Why is it the preferred way?

I don't think it is. I prefer returns in place of nested
if/else-clauses. It makes the code much more readable.

--
Anders



References