On Fri, Mar 14, 2014 at 05:04:59PM -0500, Derek Martin wrote:
> 
> I dislike those warnings because any half-competent programmer is
> aware of the *n* versions of functions, and if you chose not to use
> one there was probably a reason.  Please, Mr. Compiler, please stop
> complaining about something I know is perfectly valid and not broken.
> More specifically, -Wall should not enable these warnings, you should
> have to explicitly turn them on separately, IMO.

IIRC the warnings come from a property of the symbol in the linker
not the compiler...

The dangerous functions are actually strncpy() and strncat()
neither of which does what is expected.

snprintf() is a lot better than sprintf(), but calling any of
the alternatives 'safe' is a complete misnomer.

At some point there will be something nasty caused by the silent
truncation of strings.
OTOH generating a C++ exception is likely to be even nastier.

Some system's header files have started forcing programs to check
the error returns from some library functions.
That gets to be a PITA - is some cases you really don't care.
Also any program that looks at the return value from fprintf()
is probably broken anyway!

        David

-- 
David Laight: da...@l8s.co.uk

Reply via email to