1 /* sizes.c -- print sizes of various types
3 This file is part of the LZO real-time data compression library.
5 Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
6 Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
7 Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
8 Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
9 Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
10 Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
11 Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
12 Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
13 Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
14 Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
15 Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
16 Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
17 Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
18 Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
19 Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
20 Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
23 The LZO library is free software; you can redistribute it and/or
24 modify it under the terms of the GNU General Public License as
25 published by the Free Software Foundation; either version 2 of
26 the License, or (at your option) any later version.
28 The LZO library is distributed in the hope that it will be useful,
29 but WITHOUT ANY WARRANTY; without even the implied warranty of
30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 GNU General Public License for more details.
33 You should have received a copy of the GNU General Public License
34 along with the LZO library; see the file COPYING.
35 If not, write to the Free Software Foundation, Inc.,
36 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
38 Markus F.X.J. Oberhumer
39 <markus@oberhumer.com>
40 http://www.oberhumer.com/opensource/lzo/
44 #if (defined(_WIN32) || defined(_WIN64)) && defined(_MSC_VER)
45 #ifndef _CRT_NONSTDC_NO_DEPRECATE
46 #define _CRT_NONSTDC_NO_DEPRECATE 1
48 #ifndef _CRT_NONSTDC_NO_WARNINGS
49 #define _CRT_NONSTDC_NO_WARNINGS 1
51 #ifndef _CRT_SECURE_NO_DEPRECATE
52 #define _CRT_SECURE_NO_DEPRECATE 1
54 #ifndef _CRT_SECURE_NO_WARNINGS
55 #define _CRT_SECURE_NO_WARNINGS 1
59 #include "lzo/lzoconf.h"
102 #define print_size(type) \
103 sprintf(s,"sizeof(%s)",#type); \
104 printf("%-30s %2d\n", s, (int)sizeof(type));
106 #define print_ssize(type,m) \
107 sprintf(s,"sizeof(%s)",#type); \
108 printf("%-30s %2d %20ld\n", s, (int)sizeof(type), (long)(m));
110 #define print_usize(type,m) \
111 sprintf(s,"sizeof(%s)",#type); \
112 printf("%-30s %2d %20lu\n", s, (int)sizeof(type), (unsigned long)(m));
115 int main(int argc
, char *argv
[])
119 print_ssize(char,CHAR_MAX
);
120 print_usize(unsigned char,UCHAR_MAX
);
121 print_ssize(short,SHRT_MAX
);
122 print_usize(unsigned short,USHRT_MAX
);
123 print_ssize(int,INT_MAX
);
124 print_usize(unsigned int,UINT_MAX
);
125 print_ssize(long,LONG_MAX
);
126 print_usize(unsigned long,ULONG_MAX
);
129 print_size(void (*)(void));
131 print_ssize(lzo_int
,LZO_INT_MAX
);
132 print_usize(lzo_uint
,LZO_UINT_MAX
);
133 print_usize(lzo_uint32
,LZO_UINT32_MAX
);
134 print_size(lzo_bytep
);
136 print_size(union _lzo_align1_t
);
137 print_size(struct _lzo_align2_t
);
138 print_size(struct _lzo_align3_t
);
139 print_size(struct _lzo_align4_t
);
140 print_size(struct _lzo_align5_t
);
141 print_size(union _lzo_align6_t
);
143 if (argc
< 0 && argv
== NULL
) /* avoid warning about unused args */