I have several copies of, let's say, stddef.h
on my system, one is in the path /usr/include/linux/stddef.h
, and looks like this:
#ifndef _LINUX_STDDEF_H
#define _LINUX_STDDEF_H
#undef NULL
#if defined(__cplusplus)
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
Another one is in the path /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/include/
, and that is the one which is used when I say #include <stddef.h>
. That one's contents are a lot different from the first one, contains the definitions of ptrdiff_t
, size_t
etc.
My question is: As far as I know, the C/C++ standards require that the definition of size_t
should be placed in stddef.h
, however the first one doesn't follow that. That one clearly isn't the one mentioned by the C/C++ standards. If that file is there on for some other purpose, why are both of these files named as stddef.h
, wouldn't it be safer/more clear if they had different names?
That is not mandatory, but it is a very good idea. It means that you can easily associate the header file as being the declarations of the non-static items in a file of source code. It is not specific to embedded programming. The "file name extension" (.
A recipient MAY combine multiple header fields with the same field name into one field-name: field-value pair, without changing the semantics of the message, by appending each subsequent field value to the combined field value in order, separated by a comma.
Yes. So, multiple headers with the same name is ok (www-authenticate is such a case) if the entire field-value is defined as a comma-separated list of values.
The HTTP Headers can have one or more values depending on the header field definitions. A multi-valued header will have comma separated values.
The linux kernel does not link with the c standard library, therefore - as a general rule - the standard include files cannot be used safely, so the linux kernel uses its own include files which are known not to rely on c library functions or data.
Any software that is to run in kernel space - such as kernel modules - should use the include/linux files and not the standard library ones.
Obviously the kernel include files only cover things that are likely to be needed in the kernel so are a very small subset of the standard c include files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With