Original Post
What stupid bugs have you had in your programs that were caused by C or C++ letting you write code that does nothing at all, or something completely stupid?
I'll start:
[edit: formatting]
JohnB
[edited by - JohnBSmall on May 10, 2003 11:39:40 PM]
// the cliche
if (foo = bar)
qux();
// should be ==, not =
// the not-quite-so-cliche sibling
foo == bar;
// should be =, not ==, this code is valid syntax, but does nothing
while (foo);
{
bar();
qux();
}
// there shouldn't be a semi-colon after the condition of the while loop
// This just executes bar() and qux() once, whatever foo is