Null check what you shall not!
-
This is, incidentally, one of PHP's very nasty hidden gotchas.
And SQL, at least the MS version.
-
I found that one on google, or something like it. Felt at least as messy to me as the shell script solution. I've ended up with a whitespace-separated (name, description) definition file that is actually easy to read, which felt like an advantage to me.
-
-
The only real advantage of preprocessor-abuse techniques is that the code generation tool is very portable, being built into every C compiler, and doesn't require any unusual build steps.
It's also kind of fun, when it comes time to debug one of the xxx_tostring() functions, watching the debugger step through source code that looks like data definitions :-)
-
It's also kind of fun, when it comes time to debug one of the xxx_tostring() functions, watching the debugger step through source code that looks like data definitions :-)
Stick a rarely-taken conditional goto or two in there for additional bonus “fun”.
-
I've ended up with a whitespace-separated (name, description) definition file that is actually easy to read
For bonus blakeyrat enragement points, lay it out in sections with the enum tags in square brackets, give it a .ini filename suffix, and make sure it's more than 32K long.
-
-
while (someWidgets.end() != i)
{
if (i != 0)
{
putzWithAWidget(*i);
i++;
}
}
Better still, if i ever was 0 (and assuming that the line made sense and could be compiled), since the increment is inside the if block, and if somewidgets.end()!=0, then it will go into a tight infinite loop.
-
and assuming that the line made sense and could be compiled
That's where it all falls down....when was the last time you heard about
std::list<T>::iterator
being a typedef toT*
, or having anoperator!=(int)
?
-
This post is deleted!
-
Real human beings are TRWTF.