BitArt

Ideas Worth Spreading

导航

2013年12月1日

摘要: 结合我自己的经验,谈一谈模块化编程时#include应该出现的位置。总结起来大体有二条规则:一、规则1:只包含必要的头文件 看下面这个模块:===foo.c====#include #include #include void foo (){ printf ("hello world!\n");}===foo.h====#ifndef __foo_h__#define __foo_h__extern void foo();#endif在foo()函数中也只有简单的一行打印语句。由于printf()函数的原型声明来源于stdio.h,因此foo.c中包含了stdio.h无可厚 阅读全文

posted @ 2013-12-01 13:38 BitArt 阅读(2856) 评论(2) 推荐(1) 编辑