Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
EXTERNAL_HEADERS
RSL
etc
config
src
SIZE_T.cpp
Go to the documentation of this file.
1
// checking for fpos_t, ptrdiff_t, and size_t
2
3
25
#include "config.h"
26
27
#include <
stddef.h
>
28
#include <
stdio.h
>
29
#include <
stdlib.h
>
// for RAND_MAX
30
#include <
time.h
>
// for CLOCKS_PER_SEC
31
32
#ifndef _RWSTD_NO_WCTYPE_H
33
# include <
wctype.h
>
// for WEOF
34
#endif
// _RWSTD_NO_WCTYPE_H
35
36
// establish a dependency on the test for long long
37
// and #define the LONG_LONG macro used in "type.h"
38
#ifndef _RWSTD_NO_LONG_LONG
39
# define LONG_LONG long long
40
#else
// if defined (_RWSTD_NO_LONG_LONG)
41
# if defined (_MSC_VER)
42
# define LONG_LONG __int64
43
# endif
// _MSC_VER
44
#endif
// _RWSTD_NO_LONG_LONG
45
46
#include "
types.h
"
// for type_name()
47
48
49
void
get_type_names
(
int
dummy, ...)
50
{
51
clock_t clk = 0;
// arithmetic type
52
fpos_t
pos
= fpos_t ();
// object type
53
ptrdiff_t diff = 0;
// signed integral type
54
size_t
size
= 0;
// unsigned integral type
55
time_t tim = 0;
// arithmetic type
56
57
printf
(
"#define _RWSTD_CLOCK_T %s\n"
,
type_name
(clk));
58
printf
(
"#define _RWSTD_PTRDIFF_T %s\n"
,
type_name
(diff));
59
printf
(
"#define _RWSTD_SIZE_T %s\n"
,
type_name
(
size
));
60
61
// compute the maximum and minimum for size_t and ptrdiff_t
62
++
size
;
63
++diff;
64
printf
(
"#define _RWSTD_SIZE_MAX _RWSTD_%s_MAX\n"
,
65
type_name
(
size
));
66
printf
(
"#define _RWSTD_PTRDIFF_MIN _RWSTD_%s_MIN\n"
67
"#define _RWSTD_PTRDIFF_MAX _RWSTD_%s_MAX\n"
,
68
type_name
(diff),
type_name
(diff));
69
70
71
printf
(
"#define _RWSTD_TIME_T %s\n"
,
type_name
(tim));
72
73
#if defined (CLOCKS_PER_SEC)
74
printf
(
"#define _RWSTD_CLOCKS_PER_SEC %d\n"
,
CLOCKS_PER_SEC
);
75
#else
76
printf
(
"#define _RWSTD_NO_CLOCKS_PER_SEC\n"
);
77
#endif
// CLOCKS_PER_SEC
78
79
#if defined (RAND_MAX)
80
printf
(
"#define _RWSTD_RAND_MAX %d\n"
,
RAND_MAX
);
81
#else
82
printf
(
"#define _RWSTD_NO_RAND_MAX\n"
);
83
#endif
// RAND_MAX
84
85
#if defined (EOF)
86
printf
(
"#define _RWSTD_EOF %d\n"
,
EOF
);
87
#else
88
// define _RWSTD_EOF to the usual value even if WEOF is not #defined
89
// to avoid having to #ifdef around wchar_t code that needs the macro
90
printf
(
"#define _RWSTD_EOF %d\n"
, -1);
91
// also #define _RWSTD_NO_EOF to make it possible to determine
92
// whether EOF is or isn't defined in libc headers
93
printf
(
"#define _RWSTD_NO_EOF\n"
);
94
#endif
// EOF
95
96
#if defined (WEOF)
97
printf
(
"#define _RWSTD_WEOF %d\n"
,
WEOF
);
98
#else
99
// define _RWSTD_WEOF to the usual value even if WEOF is not #defined
100
// to avoid having to #ifdef around wchar_t code that needs the macro
101
printf
(
"#define _RWSTD_WEOF %d /* best guess */\n"
, -1);
102
// also #define _RWSTD_NO_WEOF to make it possible to determine
103
// whether WEOF is or isn't defined in libc headers
104
printf
(
"#define _RWSTD_NO_WEOF\n"
);
105
#endif
// WEOF
106
107
#if defined (L_tmpnam)
108
printf
(
"#define _RWSTD_L_TMPNAM %d\n"
,
L_tmpnam
);
109
#else
110
printf
(
"#define _RWSTD_NO_L_TMPNAM\n"
);
111
#endif
// L_tmpnam
112
113
#if defined (_IOFBF)
114
printf
(
"#define _RWSTD_IOFBF %d\n"
,
_IOFBF
);
115
#else
116
printf
(
"#define _RWSTD_NO_IOFBF\n"
);
117
#endif
// _IOFBF
118
119
#if defined (_IOLBF)
120
printf
(
"#define _RWSTD_IOLBF %d\n"
,
_IOLBF
);
121
#else
122
printf
(
"#define _RWSTD_NO_IOLBF\n"
);
123
#endif
// _IOLBF
124
125
#if defined (_IONBF)
126
printf
(
"#define _RWSTD_IONBF %d\n"
,
_IONBF
);
127
#else
128
printf
(
"#define _RWSTD_NO_IONBF\n"
);
129
#endif
// _IONBF
130
131
#if defined (BUFSIZ)
132
printf
(
"#define _RWSTD_BUFSIZ %d\n"
,
BUFSIZ
);
133
#else
134
printf
(
"#define _RWSTD_NO_BUFSIZ\n"
);
135
#endif
// BUFSIZ
136
137
#if defined (FOPEN_MAX)
138
printf
(
"#define _RWSTD_FOPEN_MAX %d\n"
,
FOPEN_MAX
);
139
#else
140
printf
(
"#define _RWSTD_NO_FOPEN_MAX\n"
);
141
#endif
// FOPEN_MAX
142
143
#if defined (FILENAME_MAX)
144
printf
(
"#define _RWSTD_FILENAME_MAX %d\n"
,
FILENAME_MAX
);
145
#else
146
printf
(
"#define _RWSTD_NO_FILENAME_MAX\n"
);
147
#endif
// FILENAME_MAX
148
149
#if defined (TMP_MAX)
150
printf
(
"#define _RWSTD_TMP_MAX %d\n"
,
TMP_MAX
);
151
#else
152
printf
(
"#define _RWSTD_NO_TMP_MAX\n"
);
153
#endif
// TMP_MAX
154
155
if
(
type_name
(
pos
))
156
printf
(
"#define _RWSTD_FPOS_T %s\n"
,
type_name
(
pos
));
157
else
{
158
printf
(
"#define _RWSTD_NO_NATIVE_FPOS_T"
159
"/* may be an aggregate */\n"
);
160
printf
(
"#define _RWSTD_FPOS_T_SIZE %u\n"
,
sizeof
pos
);
161
}
162
}
163
164
165
int
main
()
166
{
167
get_type_names
(0);
168
169
return
0;
170
}
pos
#define pos
Definition
17.names.cpp:518
type_name
const char * type_name()
printf
IMPORT_C SInt32 printf(const Char *,...)
main
int main()
Definition
SIZE_T.cpp:165
get_type_names
void get_type_names(int dummy,...)
Definition
SIZE_T.cpp:49
size
int size
Definition
TEMPLATE_ON_RETURN_TYPE.cpp:45
EOF
#define EOF
BUFSIZ
#define BUFSIZ
_IONBF
#define _IONBF
FOPEN_MAX
#define FOPEN_MAX
FILENAME_MAX
#define FILENAME_MAX
_IOLBF
#define _IOLBF
L_tmpnam
#define L_tmpnam
TMP_MAX
#define TMP_MAX
_IOFBF
#define _IOFBF
RAND_MAX
#define RAND_MAX
CLOCKS_PER_SEC
#define CLOCKS_PER_SEC
WEOF
#define WEOF
stddef.h
stdio.h
stdlib.h
time.h
types.h
wctype.h
Generated by
1.9.8