[LCP]typedefs in .h

Mike & Penny Novack stepbystepfarm at shaysnet.com
Sat Jan 19 08:33:13 UTC 2002


> Is there a fast and convinient way of finding the
> actual type (int, long, char, struct ...) for uid_t,
> dev_t, time_t, and all those types defined into the
> headers (buried to be precise)?
>

But let me refine that answer Emil.

The method you were given will give you the "actual" type in THIS (ie:
some specific) implementation. You can also examine the headers
themslves (and remember, you can use an option specifying that these
"hidden" things be expanded in the compile listing). They aren't
"buried", only seems that way because the default is "don't expand and
show me".

BUT --- there is no ACTUAL type for these things in C itself. That is
the whole purpose of having them as abstract types defined via typedefs
in headers. It makes your C source code independent of the way these
must be defined for some specific implementation. Since any actual
compile is for some specific implementation, as long as the the right
header libraries* are used for that implementation, everything will work
out WITHOUT any need to edit the source code.

Proper coding technique is for your code to make no assumptions about
things that are not defined in C like "how long is an integer"

Mike






More information about the linuxCprogramming mailing list