These kids today...

grahams - - 2 mins read

Recently a newbie asked a question about formatting numbers into strings in C, and then I received an offline mail about my answer (this message was from some other chucklehead, not the original newbie, who seemed to appreciate my answer)…. The idiot was trying to tell me to only use snprintf “where it was necessary” (and use sprintf elsewhere), while I was arguing that using all the time was good practice and “safer” (if programmers were so good at seeing their own buffer overflows all the time Bugtraq wouldn’t be so necessary)… This joker simply wouldn’t even entertain the thought that the negligible performance penalty was worth it…

To me, while I recognize that sometimes “you know” that your buffer is large enough, but it seems to me that as soon as “you know” this is true, someone will come along and modify your code just enough to make it untrue… To me, good practice means doing your best to make sure your code is maintainable through the annals of time… Of course, I am probably pretty anal about this (since I seem to be the only person who advocates putting braces around one-line if blocks)…

Bitch off…

Update: I am glad to see so many other people do one-line conditionals the “right” way… =)