00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "checkup.h"
00016
00017 #include <basis/guards.h>
00018 #include <basis/istring.h>
00019
00020 namespace system_checkup {
00021
00022 bool check_system_characteristics()
00023 {
00024
00025
00026 int byte_size = sizeof(byte);
00027 if (byte_size != 1) {
00028 continuable_error("check", "system_characteristics",
00029 "byte size should be 1 and it is not!");
00030 return false;
00031 }
00032 int int16_size = sizeof(int16);
00033 if ( (sizeof(uint16) != int16_size) || (int16_size != 2) ) {
00034 continuable_error("check", "system_characteristics",
00035 "uint16 size is inappropriate!");
00036 return false;
00037 }
00038 int uint_size = sizeof(u_int);
00039
00040 if ( (uint_size != sizeof(int)) || (uint_size != 4) ) {
00041 continuable_error("check", "system_characteristics",
00042 "u_int size is inappropriate!");
00043 return false;
00044 }
00045
00046
00047
00048 int size_t_size = sizeof(size_t);
00049 if ( (size_t_size != uint_size) || (size_t_size != 4) ) {
00050 continuable_error("check", "system_characteristics",
00051 "size_t size is inappropriate!");
00052 return false;
00053 }
00054 int long_size = sizeof(long);
00055 if (long_size != uint_size) {
00056 continuable_error("check", "system_characteristics",
00057 isprintf("long size is larger than expected: it is %d instead "
00058 "of %d", long_size, uint_size));
00059 }
00060
00061
00062
00063
00064 int int_size = sizeof(int);
00065 int addr_size = sizeof(void *);
00066 if (int_size < addr_size) {
00067 continuable_error("check", "system_characteristics",
00068 "int size is less than address size! it should be at least equal.");
00069 return false;
00070 }
00071
00072
00073 return true;
00074 }
00075
00076 }
00077