一种注释

2020-02-26

我们都知道,ANSI C中可以使用 /*...*/ 做单行和多行的注释,更新的版本和 C++ 中可以用 // 更优雅地写单行注释。但是 /*...*/ 多行注释是不允许嵌套的,有时会十分不方便。

此时我们可以利用 gcc 的预处理命令解决这个问题。如下面的代码:

for (int i=0; i<n; i++) for (int j=0; j<n; j++) {
	sum2[i*n+j]=-c[i]-d[j];
}
cout << (double)clock()/CLOCKS_PER_SEC << endl;
//sort(&sum1[1], &sum1[sum1[0]+1]);
sort(sum2, &sum2[n*n]);
/*pthread_create(&pth1, NULL, getsum1, NULL);
//pthread_create(&pth2, NULL, getsum2, NULL);
//getsum1(NULL);
//pthread_join(pth1, NULL);
//pthread_join(pth2, NULL);*/

我们希望将其全部注释,可以:

#if 0

for (int i=0; i<n; i++) for (int j=0; j<n; j++) {
	sum2[i*n+j]=-c[i]-d[j];
}
cout << (double)clock()/CLOCKS_PER_SEC << endl;
//sort(&sum1[1], &sum1[sum1[0]+1]);
sort(sum2, &sum2[n*n]);
/*pthread_create(&pth1, NULL, getsum1, NULL);
//pthread_create(&pth2, NULL, getsum2, NULL);
//getsum1(NULL);
//pthread_join(pth1, NULL);
//pthread_join(pth2, NULL);*/

#endif

by SDUST weilinfox
本文地址:https:////www.cnblogs.com/weilinfox/p/12545439.html

posted @ 2020-02-26 12:53  桜風の狐  阅读(88)  评论(0编辑  收藏  举报