Skip to content

回复:源代码文档 ​

原始发布页

打开来源页面
查看 1 个交叉存档

对于外部 API 的库,我喜欢这样做,但你大概能从代码看出,我不喜欢对内部函数这样做。每个函数都必须配上大段注释头,会拉开代码间距,也会让你在创建一个很小的函数时犹豫,因为注释头会比函数本身还长。它们也会给维护带来一些麻烦,因为函数发生变化后,还必须在注释头中重复修改。我喜欢保持代码紧凑,这样就能在屏幕上一次看到更多代码。

事到如今再添加它们,能写的也只是看一眼函数就能明白的东西。

我们现有的外部 API 位于 rpc.cpp 中,使用文档在帮助字符串里。

抱歉给大家泼冷水了。

英文原文 ​

展开英文原文

I like that in libraries for the external API's, but you can probably tell from the code that I'm not a fan of it for interior functions. Big obligatory comment headers for each function space out the code and make you hesitate about creating a small little function where the comment header would be bigger than the function. They're some trouble for maintenance, as changes to the function then require duplicate changes in the comment header. I like to keep code compact so you can see more code on the screen at once.

To add them now at this point, what would be written would just be what's obvious from looking at the function.

The external API we have, in rpc.cpp, the usage documentation is in the help string.

Sorry to be a wet blanket.

为历史保存,为中文读者整理。每篇档案均附来源与英文原文。