Put as much as you can in the .c
and as little as possible in the .h
. The includes in the .c
are only included when that one file is compiled, but the includes for the .h
have to be included by every file that uses it.
尽量放在.c中,而尽量避免放到.h中.在.c中只是在编译时被included,而在.h中则是被每个使用它的文件都included了.
整理自:https://stackoverflow.com/questions/3002110/include-in-h-or-c-cpp