Uso de RTOS
stddef.h
1 /* $Id: stddef.h,v 1.2 2004/08/04 18:52:23 GrosbaJ Exp $ */
2 #ifndef __STDDEF_H
3 #define __STDDEF_H
4 
5 typedef unsigned char wchar_t;
6 
7 /* ptrdiff_t is a bit tricky for a PIC because of the Harvard architecture.
8  * We'll use the data memory size for the generic and define additional types
9  * for specifics.
10  */
11 typedef signed short int ptrdiff_t;
12 typedef signed short int ptrdiffram_t;
13 typedef signed short long int ptrdiffrom_t;
14 
15 /* size_t is tricky as well, for the same reason. 16 bits is sufficient
16  * for data objects, but 24-bits are necessary for program memory objects.
17  * This is true even for the 17Cxx architecture, as size_t is in bytes, and
18  * the 17Cxx has an address range of 128Kbytes. We'll do the same thing
19  * as we did for ptrdiff_t.
20  */
21 typedef unsigned short int size_t;
22 typedef unsigned short int sizeram_t;
23 typedef unsigned short long int sizerom_t;
24 
25 /* NULL is a simple one. Many compilers define NULL as ((void*)0), which
26  * is not best. A pointer to void is a pointer to data and a comparison
27  * to a function pointer is a type mismatch and should result in an
28  * error. The ANSI/ISO standard makes no guarantees about pointers to
29  * data and pointers to code being at all related to one another.
30  *
31  * Since the standard requires that a pointer comparison to an integral
32  * constant value of zero be allowed and is equivalent to a comparison
33  * to the NULL pointer constant, we define NULL very simply, as '0'.
34  */
35 #define NULL 0
36 
37 /* offsetof() is a bit trickier. We define it in the standard way. The
38  * compiler should be smart enough to evaluate the expression at compile
39  * time and not run-time. It has to be as offsetof() is required by
40  * 4.1.5 to evaluate to an integer constant expression.
41  */
42 #define offsetof(type, member_designator) (size_t)(&(((type *)0)->member_designator))
43 
44 #endif /* __STDDEF_H */