Should I include this <stddef.h> ?

R

Roka

Hi, all.
I'm in Fedora Core 4 .I noticed that a lot of types are defined in
stddef.h of Stantard C.
I usually include files from /usr/include , but my stddef.h looks like
in /usr/lib/gcc/i386-redhat-linux/4.0.0/include/stddef.h.
Should I include the file from that path?? I noticed people never
include from that path.(Also in many linux programming books)

I see ptrdeff_t or size_t or ssize_t also defined in other head files
of /usr/include.
 
K

Keith Thompson

Roka said:
I'm in Fedora Core 4 .I noticed that a lot of types are defined in
stddef.h of Stantard C.
I usually include files from /usr/include , but my stddef.h looks like
in /usr/lib/gcc/i386-redhat-linux/4.0.0/include/stddef.h.
Should I include the file from that path?? I noticed people never
include from that path.(Also in many linux programming books)

I see ptrdeff_t or size_t or ssize_t also defined in other head files
of /usr/include.

You should just use "#include <stddef.h>". Let your compiler figure
out where to find it. Specifying the location will just make your
code non-portable (it will probably be in a different place next time
you upgrade your compiler, and it will almost certainly be in a
different place on a different system).

The C language itself says nothing about a /usr/include directory;
that's just a Unix convention.
 
I

Ian Collins

Roka said:
Hi, all.
I'm in Fedora Core 4 .I noticed that a lot of types are defined in
stddef.h of Stantard C.
I usually include files from /usr/include , but my stddef.h looks like
in /usr/lib/gcc/i386-redhat-linux/4.0.0/include/stddef.h.
Should I include the file from that path?? I noticed people never
include from that path.(Also in many linux programming books)
A little OT, but compilers have their own rules about include file
search paths, you may find yours will find <stddef.h> in that directory.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top