首页 > 其他 > 详细

如果代码本来就是清楚的,则不必加注释

时间:2018-08-03 13:26:24      阅读:155      评论:0      收藏:0      [点我收藏+]

如果代码本来就是清楚的,则不必加注释。否则多此一举,令人厌烦。 例如 i++; // i 加 1,多余的注释

 

 1 #include <iostream>
 2 #include <stdio.h>
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 int main(int argc, char** argv) {
 6         int c;
 7     /* Create an error by writing to standard input. */
 8     putc( A, stdin );
 9     if( ferror( stdin ) )
10     {
11       perror( "Write error" );
12       clearerr( stdin );
13     }
14 
15     /* See if read causes an error. */
16     printf( "Will input cause an error? " );
17     c = getc( stdin );
18     if( ferror( stdin ) )
19     {
20        perror( "Read error" );
21        clearerr( stdin );
22     }
23     return 0;
24 }

 

如果代码本来就是清楚的,则不必加注释

原文:https://www.cnblogs.com/borter/p/9413346.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!