News for hackers. Stuff that matters.
Re:We found over 10000 bugs in various open source projects by kazinator on Thursday August 18, 2016 @10:48AM (#12312876)
I just love this one: 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.

Re:We found over 10000 bugs in various open source projects by mgrennan on Thursday August 18, 2016 @12:32PM (#12313953)
Explains why stile matters.

... if (!spfont)

    return;
...

Just add the CR and all is reveled.

Re:We found over 10000 bugs in various open source projects by mrSugar on Thursday August 18, 2016 @11:04AM (#12313002)
Perhaps the append() also returns void. I've seen this kind of bug uncaught by gcc exactly because of that.
Re:We found over 10000 bugs in various open source projects by BruiseLee on Thursday August 18, 2016 @11:39AM (#12313333)
Gcc will not issue diagnostic if you return a "void expression" because doing so is valid in C++.
Re:We found over 10000 bugs in various open source projects by kazinator on Thursday August 18, 2016 @03:06PM (#12315433)
It could still be a warning, since doing so is dubious in C++ even if it is allowed.