Re: The joy of FORTRAN

Liste des GroupesRevenir à col misc 
Sujet : Re: The joy of FORTRAN
De : findlaybill (at) *nospam* blueyonder.co.uk (moi)
Groupes : alt.folklore.computers comp.os.linux.misc
Date : 03. Oct 2024, 17:32:02
Autres entêtes
Message-ID : <lm7v82Fl53aU1@mid.individual.net>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Mozilla Thunderbird
On 02/10/2024 08:34, 186282@ud0s4.net wrote:
On 10/1/24 6:24 AM, Stefan Ram wrote:
Peter Flass <peter_flass@yahoo.com> wrote or quoted:
The 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; }
    The whole context of 'C' was that COMPETENT PROGRAMMERS
   existed and could/would assess error conditions as THEY
   chose to do so.
The reality of C is that even competent programmers find this
very difficult and often make elementary mistakes with potentially
serious consequences, as we see on a daily basis.
--
Bill F.

Date Sujet#  Auteur
5 Jul 25 o 

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal