我搜索过,搜索过,但我不明白它们的意思。他们和他们的目的是什么?什么时候用的?我想,也许我已经太迟了,在现代编程和我这一代人看到他们。
其中一些是AFAIS,
使用/* ARGSUSED */的示例代码
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#define BUFSIZE 1024
#define TEN_MILLION 10000000L
/* ARGSUSED */
void *threadout(void *args) {
char buffer[BUFSIZE];
char *c;
struct timespec sleeptime;
sleeptime.tv_sec = 0;
sleeptime.tv_nsec = TEN_MILLION;
snprintf(buffer, BUFSIZE, "This is a thread from process %ld\n",
(long)getpid());
c = buffer;
/*****************start of critical section ********************/
while (*c != '\0') {
fputc(*c, stderr);
c++;
nanosleep(&sleeptime, NULL);
}
/*******************end of critical section ********************/
return NULL;
}
int main(int argc, char *argv[]) {
int error;
int i;
int n;
pthread_t *tids;
if (argc != 2){ /* check for valid number of command-line arguments */
fprintf (stderr, "Usage: %s numthreads\n", argv[0]);
return 1;
}
n = atoi(argv[1]);
tids = (pthread_t *)calloc(n, sizeof(pthread_t));
if (tids == NULL) {
perror("Failed to allocate memory for thread IDs");
return 1;
}
for (i = 0; i < n; i++)
if (error = pthread_create(tids+i, NULL, threadout, NULL)) {
fprintf(stderr, "Failed to create thread:%s\n", strerror(error));
return 1;
}
for (i = 0; i < n; i++)
if (error = pthread_join(tids[i], NULL)) {
fprintf(stderr, "Failed to join thread:%s\n", strerror(error));
return 1;
}
return 0;
}发布于 2017-08-15 10:58:59
对于lint来说,压制对特定问题的评论是特定的
维基百科里的皮棉是什么?
在计算机编程中,lint是一个Unix实用程序,它在C语言源代码中标记一些可疑和不可移植的结构(可能是bug);一般说来,lint或linter是任何用任何计算机语言编写的软件中标记可疑使用情况的工具。类似皮棉的行为一词有时适用于标记可疑语言使用的过程。类似Lint的工具通常对源代码执行静态分析。 Lint作为一个术语也可以更广泛地指语法差异,特别是在解释语言如JavaScript和Python中。例如,现代的lint检查器通常用于查找不符合特定样式准则的代码。由于这些语言缺乏在执行之前显示错误列表的编译阶段,所以它们也可以用作常见错误的简单调试器(将语法差异显示为错误)或难以找到诸如heisenbugs (提请注意可疑代码为“可能的错误”)的错误。
项目
描述
/*NOTREACHED*/ Suppresses comments about unreachable code.
/*VARARGSNumber*/ Suppresses checking the following old style function declaration for varying numbers of arguments, but does check the data type of the first Number arguments. If you do not include a value for Number, the lint command checks no arguments (Number=0). The ANSI function prototypes should use the ellipsis to indicate unspecified parameters rather than this comment mechanism.
/*ARGSUSED*/ Suppresses warnings about function parameters not used within the function definition.
/*LINTLIBRARY*/ If you place this comment at the beginning of a file, the lint command does not identify unused functions and function parameters in the file. This is used when running the lint command on libraries.
/*NOTUSED*/ Suppresses warnings about unused external symbols, functions and function parameters in the file beginning at its point of occurrence. This is a superset of the /*LINTLIBRARY*/ comment directive, but applies also to external symbols. It is useful for suppressing warnings about unused function prototypes and other external object declarations.
/*NOTDEFINED*/ Suppresses warnings about used, but undefined external symbols and functions in the file beginning at its point of occurrence.
/*LINTSTDLIB*/ Permits a standard prototype-checking library to be formed from header files by making function prototype declarations appear as function definitions. This directive implicitly activates both the /*NOTUSED*/ and /*LINTLIBRARY*/ comment directives to reduce warning noise levels.也许其他工具也会用到它们。
你也可以找到另一个特别的评论。例如,许多IDE在注释中都有自己的标记--例如,将某些内容添加到要做的列表中。
https://stackoverflow.com/questions/45691200
复制相似问题