3 ms·
I just love this one: http://www.viva64.com/en/examples/V504/ http://www.viva64.com/en/examples/V504/ void GlyphComboBox::update(SPFont* spfont) { if (
by kazinator 10y ago
I just love this one: http://www.viva64.com/en/examples/V504/ http://www.viva64.com/en/examples/V504/
void GlyphComboBox::update(SPFont* spfont)
{
if (!spfont) return // <=
//TODO: figure out why do we need to append("")
// before clearing items properly...
//Gtk is refusing to clear the combobox
//when I comment out this line
this->append("");
this->remove_all();
}
Gee, why do you need the dummy append? It's because you put in so many TODO comments that you concealed the missing semicolon that you otherwise might have found ...
This is arguably not a bug; the developer tested the code, massaged it into working as expected, using what look like well-defined constructs, and documented their surprise at certain aspects of the code, leaving this issue easy to find with a grep for TODO.
On another note, what is surprising here is that they didn't catch it with their compiler. Look, the function returns void. GCC has a diagnostic for this, something like "return with expression in a function returning void". I think that still kicks in even if that expression has void type.
- mrSugar 10y agoPerhaps the append() also returns void. I've seen this kind of bug uncaught by gcc exactly because of that.
- BruiseLee 10y agoGcc will not issue diagnostic if you return a "void expression" because doing so is valid in C++.
- kazinator 10y agoIt could still be a warning, since doing so is dubious in C++ even if it is allowed.
- mgrennan 10y agoExplains why stile matters. ... if (!spfont) return; ... Just add the CR and all is reveled.