Liste des Groupes | Revenir à col misc |
On 10/1/24 6:24 AM, Stefan Ram wrote:The reality of C is that even competent programmers find thisPeter Flass <peter_flass@yahoo.com> wrote or quoted:The whole context of 'C' was that COMPETENT PROGRAMMERSThe Natural Philosopher <tnp@invalid.invalid> wrote:>printf("hello world"); That's bug proof.Wait, what? Where’s your error checking? What if your printf fails?
Actually that’s one of the things I like least about C. It leaves all error
checking up to the programmer instead of having even a minimal handler for
errors not otherwise caught.
You could write a wrapper for printf, "myprintf",
that will call printf and then do minimal error handling.
>
#include <stdio.h>
#include <stdarg.h>
>
int myprintf( char const * format, ... )
{ va_list args;
va_start( args, format );
int const result = vprintf( format, args );
va_end( args );
if( result < 0 )fprintf
( stderr, "Error: printf failed with return code %d\n", result );
return result; }
existed and could/would assess error conditions as THEY
chose to do so.
Les messages affichés proviennent d'usenet.