[Courses] [C] Lesson Three: Basic Declarations & Expressions

Eugene Teo eugene.teo at eugeneteo.net
Fri Oct 11 07:57:10 EST 2002


If that is the case, myheader.h should include stdio.h since it uses
some Constants and not include stdio.h in other file. It doesn't make
sense. Don't you think so? 

Eugene

<quote who="Akkana">
u> KWMelvin writes:
u> > u> On Thu, Oct 10, 2002 at 06:14:26PM +0300, Anca M. Holban wrote:
u> > u> #include "myheader.h"  /* contains my declarations, etc. */
u> > u> #include <stdio.h>     /* Standard C Library header file */
u> 
u> Eugene Teo writes:
u> > correction. always include after standard headers.
u> 
u> Why?
u> 
u> I usually do it the other way around: I include my own header first,
u> before standard headers.  That way, I find out whether my header file
u> (which ideally is meant to be portable and re-usable in other projects)
u> has dependencies which it doesn't satisfy.  For example, if myheader.h
u> refers to EOF and expects to get that from stdio.h, then it should
u> probably include stdio.h itself; but I could easily not notice that
u> problem if I included stdio.h before myheader.h, and then anyone who
u> ever used myheader would have to include stdio as well.  This gets
u> complicated when you have complicated header files that depend on
u> six or seven other header files (which each depend on ...) and it
u> can be a real pain for whoever tries to reuse your code.
u> 
u> 	...Akkana
u> _______________________________________________
u> Courses mailing list
u> Courses at linuxchix.org
u> http://mailman.linuxchix.org/mailman/listinfo/courses

-- 
eMail: eugeneteo at eugeneteo.net, eugeneteo at null.cc.uic.edu
gpg pub_key: http://null.cc.uic.edu/~eugeneteo/eugeneteo.asc
main(i){putchar(182623909>>(i-1)*5&31|!!(i<7)<<6)&&main(++i);}




More information about the Courses mailing list