A question on C programming style

bxpfac at umiami.ir.miami.edu bxpfac at umiami.ir.miami.edu
Sat Apr 13 00:36:21 AEST 1991


How do the guru's on the net feel about the following two styles?

Style 1: (No nested includes - user responsible for proper order of includes).
--------
foo.h
  extern save_data (FILE *fp);

use.c
  #include <stdio.h>    /* Needed because FILE used in foo.h and has to be
                           included foo.h. */
  #include "foo.h"

Style 2: (Nested inclusion).
--------
foo.h
  #include <stdio.h>     /* We know that this has to be included with this. */
  extern save_data (FILE *fp);

use.c
  #include "foo.h"

  #include <stdio.h>    /* Is now optional and if included, would not be 
                           included twice provided that the <stdio.h> is
                           set up properly. */
   

Bimal / devebw9f at miavax.ir.miami.edu



More information about the Comp.lang.c mailing list