[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++ cleanup : get rid of some compilation warnings (issue 353880043
From: |
dak |
Subject: |
Re: C++ cleanup : get rid of some compilation warnings (issue 353880043 by address@hidden) |
Date: |
Tue, 19 Feb 2019 04:55:10 -0800 |
https://codereview.appspot.com/353880043/diff/2/lily/beam-quanting.cc
File lily/beam-quanting.cc (right):
https://codereview.appspot.com/353880043/diff/2/lily/beam-quanting.cc#newcode1039
lily/beam-quanting.cc:1039: string card = best->score_card_ + to_string
(" c%d/%lu", completed, configs.size ());
I think that %lu is not guaranteed platform-independently to correspond
to size_t (or whatever we have here). There may be some special letter
for it, or maybe it is only a GNU extension.
[Initial thought, later revised:] Maybe bite the bullet and use
string card = (std::stringstream (best->score_card_) << " c" <<
completed << "/" << configs.size ()).str ();
instead? It's not what we use elsewhere (yet) but it should be
comparatively future-proof and is what C++ is supposed to use.
It would need #include <sstream> to work.
[Revision: use %zu, see later for rationale]
https://codereview.appspot.com/353880043/diff/2/lily/main.cc
File lily/main.cc (right):
https://codereview.appspot.com/353880043/diff/2/lily/main.cc#newcode635
lily/main.cc:635: { }; // ignore option for backwards compatibility
This code is insane. Maybe just outcomment the whole else if branch
instead?
https://codereview.appspot.com/353880043/diff/2/lily/text-interface.cc
File lily/text-interface.cc (right):
https://codereview.appspot.com/353880043/diff/2/lily/text-interface.cc#newcode176
lily/text-interface.cc:176: non_fatal_error (_f ("Markup depth exceeds
maximal value of %lu; "
Ugh. stringstream does not really work sensibly with _f, does it?
Scratch the previous idea. Wouldn't this then need %zu instead?
Assuming that C++ is following C99 in that regard?
https://codereview.appspot.com/353880043/
- Re: C++ cleanup : get rid of some compilation warnings (issue 353880043 by address@hidden),
dak <=
- Re: C++ cleanup : get rid of some compilation warnings (issue 353880043 by address@hidden), lemzwerg, 2019/02/19
- Re: C++ cleanup : get rid of some compilation warnings (issue 353880043 by address@hidden), dak, 2019/02/19
- Re: C++ cleanup : get rid of some compilation warnings (issue 353880043 by address@hidden), lemzwerg, 2019/02/19
- Re: C++ cleanup : get rid of some compilation warnings (issue 353880043 by address@hidden), v . villenave, 2019/02/19
- Re: C++ cleanup : get rid of some compilation warnings (issue 353880043 by address@hidden), v . villenave, 2019/02/19