你遇到过的源代码中最好的注释是什么?
当前回答
def leppard
# what, i cant have my own convention?
end
其他回答
好吧,这是我刚刚提到的一个问题:
/* Every time I re-visit this function, I feel like
* I need to take a shower.
*
* Don't get too used to this function, its days are
* numbered.
*/
有人可以创建像greatcodecomments.com这样的网站,然后赚点钱。然而,那个人不是我。
在drivers/net/sunhme.c (Linux内核)中:
/* Welcome to Sun Microsystems, can I take your order please? */
if(!hp->happy_flags & HFLAG_FENABLE)
return happy_meal_bb_write(hp, tregs, reg, value);
/* Would you like fries with that? */
hme_write32(hp, &tregs->frame,
(FRAME_WRITE | (hp->paddr << 23) |
((reg & 0xff) << 18) | (value & 0xffff)));
while(!(hme_read32(hp, &tregs->frame) & 0x10000) && --tries)
udelay(20);
/* Anything else? */
if(!tries)
printk(KERN_ERR "happy meal: Aieee, transceiver MIF write bolixed\n");
/* Fifty-two cents is your change, have a nice day. */
我最喜欢的评论是我的一个同性恋朋友说的。他喜欢用VB标记他所有的TODO注释。净,
'TODO: Matt Damon
有时会提供额外的信息,但通常不是这样。
我的精选集:
// Thats the end of the While loop
// Clean up last row. I really must program better than this.
// Note: You can't immediately tell if the line below works.
// Rounding - blech. It's assumed that all .5s are rounded up.
// Sort out predictions first. Seems like the right place for a prediction, 'first'.
// Let's interpret!
从/系统/图书馆/框架/ AppKit.framework /版本/ C /头/ NSTextView.h:
- (void)smartInsertForString:(NSString *)pasteString replacingRange:(NSRange)charRangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString;
- (NSString *)smartInsertBeforeStringForString:(NSString *)pasteString replacingRange:(NSRange)charRangeToReplace;
- (NSString *)smartInsertAfterStringForString:(NSString *)pasteString replacingRange:(NSRange)charRangeToReplace;
/* Java note: The second and third methods are the primitives and are the
methods exposed in Java. The first method calls the other two. All
Objective-C code calls the first method. In either Objective-C or Java any
overriding should be done for the second and third methods, not the first
method. This will all work out correctly with the exception of existing code
that overrides the first method. Existing subclasses that do this will not
have their implementations available to Java developers. Isn't Java wonderful? */
推荐文章
- 在VS Code中禁用“Comments are not allowed In JSON”错误
- Swift:理解// MARK
- 在构建中编写注释的语法是什么?gradle文件?
- Java注释中的/**和/*
- 有没有办法注释掉.ASPX页面中的标记?
- Jenkins:注释可以添加到Jenkins文件中吗?
- TypeScript注释的语法记录在哪里?
- CSV文件可以有注释吗?
- 什么是自文档化代码?它能取代文档化良好的代码吗?
- 在erb中添加注释的最佳方法
- 为什么Python没有多行注释?
- 我应该在批处理文件中使用哪种注释风格?
- 如何在Office VBA编辑器中注释和取消注释代码块
- “# noqa”在Python注释中是什么意思?
- 我可以向pip需求文件添加注释吗?