On 12/09/2015 12:54 AM, Scott Kostyshak wrote:
> Regarding the following code:
>
> -----
> void Text::selectWord(Cursor & cur, word_location loc)
> {
>   LBUFERR(this == cur.text());
>   CursorSlice from = cur.top();
>   CursorSlice to = cur.top();
>   getWord(from, to, loc);
> -----
>
> It is not easy to know whether "to" and "from" are equal to each other because
> cur.top() might return something different the second time. For readability
> purposes, I would prefer either
>
>   LBUFERR(this == cur.text());
>   CursorSlice from, to;
>   from = to = cur.top();
>   getWord(from, to, loc);
>
> or 
>
>   LBUFERR(this == cur.text());
>   CursorSlice from = cur.top();
>   CursorSlice to = from;
>   getWord(from, to, loc);
>
> Does anyone else have a preference?

The latter makes more sense to me, if that makes any sense ;-/

Richard

Reply via email to