A question on C programming style

Mark William Hopkins markh at csd4.csd.uwm.edu
Sat Apr 13 07:06:36 AEST 1991


In article <1991Apr12.103621.8907 at umiami.ir.miami.edu> devebw9f at miavax.ir.miami.edu writes:
>How do the guru's on the net feel about the following two styles?
(nested includes)

ANSI-C doesn't care if you include the same .h file twice or more (if they
contain only declarations and not definitions).  They went out of their way
(the standards-makers) to ensure this to be so.

Anyway, if you include a.h into b.h, a.h is usually make secure by nesting it
in an #ifndef:

#ifndef A_INCLUDED
#   define A_INCLUDED
... rest of a.h
#endif

<stdio.h> might have something like this in it...



More information about the Comp.lang.c mailing list