Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do some C standard headers begin with 'std' while others don't?

Tags:

c

c99

c89

c11

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?

like image 833
szx Avatar asked Dec 13 '12 04:12

szx


1 Answers

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.

like image 180
Jonathan Leffler Avatar answered Oct 22 '22 13:10

Jonathan Leffler