lilypond-devel
[Top][All Lists]
Advanced

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

Re: lily: fix some type conversion warnings (issue 557190043 by address@


From: hanwenn
Subject: Re: lily: fix some type conversion warnings (issue 557190043 by address@hidden)
Date: Wed, 22 Jan 2020 02:18:47 -0800

On 2020/01/22 10:15:03, hanwenn wrote:
> On 2020/01/21 15:21:56, Dan Eble wrote:
> >
>
https://codereview.appspot.com/557190043/diff/581490044/lily/pointer-group-interface.cc
> > File lily/pointer-group-interface.cc (right):
> > 
> >
>
https://codereview.appspot.com/557190043/diff/581490044/lily/pointer-group-interface.cc#newcode30
> > lily/pointer-group-interface.cc:30: return arr ? int (arr->size ())
: 0;
> > MHO: Return a vsize.  Somewhere, sometime, someone will probably
say,
> > 
> >     my_things_.size () < pgi.count ()
> > 
> > and the compiler will warn about comparing int to size_t.
> > 
> > I don't suggest that you switch to vsize and ferret out all the
consequences
> at
> > this time if you don't want to invest your time in that, but that
it's better
> to
> > leave this line alone and live with the warning until there is time
to take a
> > proper look.
> > 
> >
https://codereview.appspot.com/557190043/diff/581490044/lily/quote-iterator.cc
> > File lily/quote-iterator.cc (right):
> > 
> >
>
https://codereview.appspot.com/557190043/diff/581490044/lily/quote-iterator.cc#newcode104
> > lily/quote-iterator.cc:104: int hi = int (scm_c_vector_length
(vec));
> > If scm_c_vector_length () is returning size_t, then why don't we
work in terms
> > of size_t?  Any place I see a cast, especially a C-style cast, I
feel the urge
> > to stop and ask, "Why is this OK?"  So I'd rather not see them where
they can
> be
> > avoided.
> > 
> > https://codereview.appspot.com/557190043/diff/581490044/lily/stem.cc
> > File lily/stem.cc (right):
> > 
> >
https://codereview.appspot.com/557190043/diff/581490044/lily/stem.cc#newcode94
> > lily/stem.cc:94: int len = int (scm_ilength (lst)); // -1 for dotted
lists!
> > ditto
> 
> Can we go back to basics? 
> 
> Why do we need to have the distinction between size_t and int? I know
the
> standard library returns size_t in some places, but is there any
reason for
> LilyPond to used unsigned integers anywhere? 
> 
> I think the most practical solution is to cast any unsigned to int
directly
> where we get it out of the external library.

alternately, we could just do -Wno-conversion in the makefile, and we
wouldn't have to do any work here at all.

https://codereview.appspot.com/557190043/



reply via email to

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