lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clean up embedded scheme parsing/evaluation. (issue 577410045 by add


From: nine . fierce . ballads
Subject: Re: Clean up embedded scheme parsing/evaluation. (issue 577410045 by address@hidden)
Date: Fri, 31 Jan 2020 09:38:54 -0800

On 2020/01/30 23:22:46, hanwenn wrote:
> In the lily/ directory
> 
>  git grep 'vector<[^>]\+> &' *c|grep -v const
> 
> returns 20 results, which is pretty small, given the number of methods
in the
> code base. A cursory inspection suggests that Mike introduced most of
these, and
> I would have probably suggested to use pointers there too. I would
also change
> these signatures if would stumble across them while refactoring
something else.

Wouldn't this policy tend toward crimes against readability like the
following?

void twiddle_vector(vector<int> *vec)
{
  if (!vec || vec->empty ())
    return;

  for (size_t i = 0; i < vec->size() - 1; ++i)
    {
      if ((*vec)[i] < 10)
         (*vec)[i] = (*vec)[i] + 2 * (*vec)[i + 1];
      else
        (*vec)[i] = (*vec)[i] * 2 - (*vec)[i + 1];
    }
}

How would you approach that?

https://codereview.appspot.com/577410045/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]