Re: Programming Context

Liste des GroupesRevenir à ol advocacy 
Sujet : Re: Programming Context
De : ff (at) *nospam* linux.rocks (Farley Flud)
Groupes : comp.os.linux.advocacy
Date : 24. Apr 2024, 13:39:14
Autres entêtes
Organisation : UsenetExpress - www.usenetexpress.com
Message-ID : <17c93467f22541ba$146860$4052113$802601b3@news.usenetexpress.com>
References : 1 2
On Tue, 23 Apr 2024 20:59:17 -0500, Physfitfreak wrote:

 
Could you post a sample?
>

===========================
From this (conventional):
===========================

// open to read file or stdin
   if (argc > 2) {
      if(!strcmp(argv[2],"-")) {
         fd = stdin; ft=1;
      } else {
         fd = fopen(argv[2],"r");
         if (NULL == fd) {
            fprintf(stderr, "Unable to open '%s': %s\n", argv[1], strerror(errno));
            exit(EXIT_FAILURE);
         }
      }
   } else {
      fd = stdin; ft=1;
   }

===================
To this (mine):
===================

// open to read file or stdin
if (argc > 2) { //outer if

if(!strcmp(argv[2],"-")) { //inner if
fd = stdin; ft=1;
}

else { //inner else
fd = fopen(argv[2],"r");

if (NULL == fd) {
fprintf(stderr, "Unable to open '%s': %s\n", argv[1], strerror(errno));
exit(EXIT_FAILURE);
}

} //end inner else

} //end outer if

else { //outer else
fd = stdin; ft=1;
}

Comments could be better, and colorizing would be best.

Recall that the first written languages, like Chinese, went
up to down, i.e. vertically.

The human brain prefers a vertical orientation when grasping
sections.

When dealing with deeply nested structure, the horizontal indents
will literally start pushing code way off the page.  In such
cases vertical indentation is almost mandatory.

Others will object and criticize, but then their brains are
not human.

Ha, ha, ha, ha, ha, ha, ha, ha, ha!


Date Sujet#  Auteur
23 Apr 24 * Programming Context23Farley Flud
23 Apr 24 +- Re: Programming Context1Chris Ahlstrom
23 Apr 24 +* Re: Programming Context3rbowman
23 Apr 24 i+- Re: Programming Context1Farley Flud
24 Apr 24 i`- Re: Programming Context1Lawrence D'Oliveiro
24 Apr 24 +* Re: Programming Context3Physfitfreak
24 Apr 24 i`* Re: Programming Context2Farley Flud
24 Apr 24 i `- Re: Programming Context1Physfitfreak
24 Apr 24 +* Re: Programming Context10Lawrence D'Oliveiro
24 Apr 24 i+* Re: Programming Context8candycanearter07
24 Apr 24 ii+- Re: Programming Context1RonB
25 Apr 24 ii`* Re: Programming Context6Lawrence D'Oliveiro
25 Apr 24 ii +* Re: "left-justified"2Lawrence D'Oliveiro
25 Apr 24 ii i`- Re: "left-justified"1RonB
25 Apr 24 ii +* Re: Programming Context2rbowman
25 Apr 24 ii i`- Re: Programming Context1Physfitfreak
25 Apr 24 ii `- Re: Programming Context1RonB
24 Apr 24 i`- Re: Programming Context1RonB
24 Apr 24 +* Re: Programming Context3DFS
24 Apr 24 i`* Re: Programming Context2Joel
24 Apr 24 i `- Re: Programming Context1DFS
24 Apr 24 +- Re: Programming Context1DFS
24 Apr 24 `- Re: Programming Context1DFS

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal