On Sat, Feb 6, 2010 at 2:25 PM, Edwin Groothuis <edwin@mavetju.org> wrote:
Jonathan Leffler <jonathan.leffler <at> gmail.com> writes:
You could avoid the cast by using: return strcpy(buf, "??? ??? ?? ??:??:?? ????\n");This is one of the few occasions when the return value from strcpy() actually is useful.
I have a hard time finding a gcc option to enable these "returned value not used" warnings which would need this cast... :-)
There are other tools than GCC for measuring the 'quality' of code - and some of them get antsy (or, more accurately, used to get antsy) about not using the values returned by a function, the obvious example being 'lint'. On the whole, GCC does a good job of not whingeing when it isn't necessary; not all analysis programs have such good heuristics. I seldom use 'lint' these days (as in, I'm not sure when I did last use it). I had to check whether it was available on MacOS X and to my not very big surprise, it is not, but it tends to be available on the classic versions of Unix derived from AT&T System V. -- Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h> Guardian of DBD::Informix - v2008.0513 - http://dbi.perl.org "Blessed are we who can laugh at ourselves, for we shall never cease to be amused."