author | Markus Bröker<broeker.markus@googlemail.com> |
Fri, 20 Oct 2017 06:43:33 +0200 | |
changeset 169 | df7c720bcaa6 |
parent 77 | 49e0babccb23 |
permissions | -rw-r--r-- |
0 | 1 |
/** |
77 | 2 |
* data_types.c |
9
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
8
diff
changeset
|
3 |
* Copyright (C) 2008 Markus Broeker |
0 | 4 |
*/ |
5 |
||
6 |
#include <stdio.h> |
|
7 |
#include <stdlib.h> |
|
8 |
#include <math.h> |
|
9 |
#include <limits.h> |
|
10 |
#include <float.h> |
|
11 |
||
12 |
typedef unsigned char UCHAR; |
|
13 |
typedef signed char SCHAR; |
|
14 |
typedef unsigned short USHORT; |
|
15 |
typedef signed short SSHORT; |
|
16 |
typedef unsigned int UINT; |
|
17 |
typedef signed int SINT; |
|
18 |
typedef unsigned long ULONG; |
|
19 |
typedef signed long SLONG; |
|
20 |
||
21 |
#ifdef __USE_ISOC99 |
|
22 |
typedef unsigned long long ULLONG; |
|
23 |
typedef signed long long SLLONG; |
|
24 |
#endif |
|
25 |
||
26 |
int main (int argc, char **argv) |
|
27 |
{ |
|
28 |
printf ("%20s %4s %20s %25s\n\n", "Type", "BITS", "MIN", "MAX"); |
|
29 |
||
169
df7c720bcaa6
Service Pack 1 for a software from 2008 :gg
Markus Bröker<broeker.markus@googlemail.com>
parents:
77
diff
changeset
|
30 |
printf ("%20s %4lu %20d %25d\n", " signed char", 8 * sizeof (SCHAR), CHAR_MIN, CHAR_MAX); |
df7c720bcaa6
Service Pack 1 for a software from 2008 :gg
Markus Bröker<broeker.markus@googlemail.com>
parents:
77
diff
changeset
|
31 |
printf ("%20s %4lu %20d %25d\n", " signed short", 8 * sizeof (SSHORT), SHRT_MIN, SHRT_MAX); |
df7c720bcaa6
Service Pack 1 for a software from 2008 :gg
Markus Bröker<broeker.markus@googlemail.com>
parents:
77
diff
changeset
|
32 |
printf ("%20s %4lu %20d %25d\n", " signed int", 8 * sizeof (SINT), INT_MIN, INT_MAX); |
df7c720bcaa6
Service Pack 1 for a software from 2008 :gg
Markus Bröker<broeker.markus@googlemail.com>
parents:
77
diff
changeset
|
33 |
printf ("%20s %4lu %20ld %25ld\n", " signed long", 8 * sizeof (SLONG), LONG_MIN, LONG_MAX); |
0 | 34 |
|
35 |
#ifdef __USE_ISOC99 |
|
169
df7c720bcaa6
Service Pack 1 for a software from 2008 :gg
Markus Bröker<broeker.markus@googlemail.com>
parents:
77
diff
changeset
|
36 |
printf ("%20s %4lu %20lld %25lld\n\n", " signed llong", 8 * sizeof (SLLONG), (SLLONG) LLONG_MIN, LLONG_MAX); |
0 | 37 |
#endif |
38 |
||
169
df7c720bcaa6
Service Pack 1 for a software from 2008 :gg
Markus Bröker<broeker.markus@googlemail.com>
parents:
77
diff
changeset
|
39 |
printf ("%20s %4lu %20d %25u\n", " unsigned char", 8 * sizeof (UCHAR), 0, UCHAR_MAX); |
df7c720bcaa6
Service Pack 1 for a software from 2008 :gg
Markus Bröker<broeker.markus@googlemail.com>
parents:
77
diff
changeset
|
40 |
printf ("%20s %4lu %20d %25u\n", "unsigned short", 8 * sizeof (USHORT), 0, USHRT_MAX); |
0 | 41 |
|
169
df7c720bcaa6
Service Pack 1 for a software from 2008 :gg
Markus Bröker<broeker.markus@googlemail.com>
parents:
77
diff
changeset
|
42 |
printf ("%20s %4lu %20d %25u\n", " unsigned int", 8 * sizeof (UINT), 0, UINT_MAX); |
df7c720bcaa6
Service Pack 1 for a software from 2008 :gg
Markus Bröker<broeker.markus@googlemail.com>
parents:
77
diff
changeset
|
43 |
printf ("%20s %4lu %20lu %25lu\n", " unsigned long", 8 * sizeof (ULONG), 0UL, ULONG_MAX); |
0 | 44 |
|
45 |
#ifdef __USE_ISOC99 |
|
169
df7c720bcaa6
Service Pack 1 for a software from 2008 :gg
Markus Bröker<broeker.markus@googlemail.com>
parents:
77
diff
changeset
|
46 |
printf ("%20s %4lu %20llu %25llu\n", "unsigned llong", 8 * sizeof (ULLONG), 0ULL, ULLONG_MAX); |
0 | 47 |
#endif |
48 |
||
49 |
#ifdef __USE_ISOC99 |
|
169
df7c720bcaa6
Service Pack 1 for a software from 2008 :gg
Markus Bröker<broeker.markus@googlemail.com>
parents:
77
diff
changeset
|
50 |
printf ("\n%20s %4lu %20d %20d\n", "_Bool", 8 * sizeof (_Bool), 0, 1); |
0 | 51 |
#endif |
52 |
||
169
df7c720bcaa6
Service Pack 1 for a software from 2008 :gg
Markus Bröker<broeker.markus@googlemail.com>
parents:
77
diff
changeset
|
53 |
printf ("\n%20s %4lu \t\t %#1.2g \t\t %#1.2g\n", "float", 8 * sizeof (float), (double)FLT_MIN, (double)FLT_MAX); |
df7c720bcaa6
Service Pack 1 for a software from 2008 :gg
Markus Bröker<broeker.markus@googlemail.com>
parents:
77
diff
changeset
|
54 |
printf ("%20s %4lu \t\t %#1.2g \t\t %#1.2g\n", "double", 8 * sizeof (double), (double)DBL_MIN, (double)DBL_MAX); |
0 | 55 |
|
8
96d16dfe787a
We use return EXIT_SUCCESS instead of return 0
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
56 |
return EXIT_SUCCESS; |
0 | 57 |
} |