Вопрос

For example, in the new C11 standard there have been added stdalign.h and threads.h. Why not stdthreads.h or align.h? Is it to avoid collisions with existing libraries and system headers?

Это было полезно?

Решение

At various times, there have been various reasons for the names chosen. <stdio.h> was in use as a name long before there was a C standard; the standard simply standardized existing practice. The <stddef.h> header was an invention of the original (C89) committee; its name was chosen because it wasn't in use. Similarly with <stdlib.h>. The name <inttypes.h> was existing practice, but the committee needed <stdint.h> to serve free-standing implementations. The name <stdarg.h> was chosen to parallel the non-prototype equivalent <varargs.h>. The name <stdbool.h> was not in use; likewise, I guess, <stdatomic.h>, <stdalign.h>, <stdnoreturn.h>. The std prefix is largely reserved for the standard (but I use a header "stderr.h", knowing I could be treading on thin ice). As to why <uchar.h> and <threads.h> did not end up with a std prefix, I'd hypothesize some prior art that was substantially unchanged. AFAIK, the C2011 Rationale has not been completed yet; it may reveal more information when it is available.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top