我搜索了SO并用Google搜索,但我没有得到它们的含义.他们和他们的目的是什么?他们什么时候用?我想也许在现代编程和我这一代中,我已经来不及看到它们了.
其中一些是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;
}
Run Code Online (Sandbox Code Playgroud)
它特定于lint抑制有关特定问题的评论
什么是棉绒 - 来自维基百科
在计算机编程中,lint是一个Unix实用程序,它在C语言源代码中标记一些可疑和非可移植的构造(可能是bug); 一般来说,lint或linter是标记用任何计算机语言编写的软件中可疑用法的任何工具.类似lint的行为有时适用于标记可疑语言使用的过程.类似于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.
Run Code Online (Sandbox Code Playgroud)
也许其他工具也可以使用它们.
您可能还会发现另一条特别评论.例如,许多IDE在注释中放置了自己的标记 - 例如,向TO DO List添加内容