Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: _t typedefs Message-ID: <15713@haddock.ima.isc.com> Date: 21 Jan 90 20:08:33 GMT References: <11078@attctc.Dallas.TX.US> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Distribution: na Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 28 In article <11078@attctc.Dallas.TX.US> bobc@attctc.Dallas.TX.US (Bob Calbridge) writes: >Okay, I'll byte. What are "_t" typedefs? Especially the ubiquitous >"size_t"? In what header file do you find it? Most types (|FILE| is a historical exception) defined in the ANSI C standard are in the |_t| namespace. |size_t| is an unsigned type representing object sizes (e.g. the type returned by the |sizeof| operator). It is |unsigned int| on most machines but would be |unsigned long| on a few (e.g. 16-bit PCs in huge model). (which is not ANSI, but is found on Unix and POSIX systems) also defines several names with the |_t| suffix. Generally, a type is defined in each% header file that needs to mention it. Since quite a few functions use |size_t|, it is defined in , , , and as well as its "natural header", .$ Karl W. Z. Heuer (karl@haddock.isc.com or ima!haddock!karl), The Walking Lint ________ % An exception is |va_list|, which is *not* defined in even though it is the type of the last arg to |vprintf|. The implementor must manually expand the typedef in this case. $ In order to get this right--without having one header blindly include another, which is forbidden--the implementor has to put a guard around each instance of the typedef, e.g.: #if !defined(_T_SIZE) #define _T_SIZE typedef unsigned int size_t; #endif