谈到C code,头文件和源文件 [英] Commenting C code, header and source files

查看:185
本文介绍了谈到C code,头文件和源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一个最佳实践来记录我的C code。就像在任何项目中,我有一些头文件.H和相应的源文件.C

I'm looking for a "best practice" to document my C code. Like in any project I have some header files ".h" and the respective source file ".c"

在你把什么样的评论的头文件?而在源文件?
问题出现了,因为自从我的评论以及我的头文件的C文件看起来像一个烂摊子。

In the header file what kind of comment you put in? And in source files? The question arise up because since I commented well my header files, the c files looks like a mess.

什么是您的最佳实践,在保持code很好的注释?

What's your best practices in keeping the code well commented?

推荐答案

头是为在code的的用户的。因此,在那里我的文档的接口的:如何使用它,preconditions和后置条件,等等。

The header is meant for users of the code. So in there I document the interface: how to use it, preconditions and postconditions, etcetera.

.c文件是的维护者的。在那里,我记录下的实施的:事情内部是如何工作的,以及为什么他们工作的方式。

The .c file is for maintainers. In there, I document the implementation: how things work internally, and why they work that way.

这篇关于谈到C code,头文件和源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆