ecl_unknown.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_CONFIG_UNKNOWN_HPP_
13 #define ECL_CONFIG_UNKNOWN_HPP_
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #include <limits>
20 #include <climits>
21 
22 /*****************************************************************************
23 ** Integers
24 *****************************************************************************/
25 
26 /*
27  * The c99 standard will only define certain macros for c++
28  * if explicitly requested.
29  */
30 #define __STDC_LIMIT_MACROS
31 
32 #if defined(__GNUC__)
33  /*
34  * Note that cstdint is not enabled by default by gcc yet (v4.4). It will
35  * give a compile time error unless you explicitly pass -std=c++0x to gcc.
36  */
37  #if __GXX_EXPERIMENTAL_CXX0X__ > 0
38  #include <cstdint>
39  #else
40  #include <stdint.h>
41  #endif
42 #elif (defined(__STDC__) && __STDC__)
43  #include <stdint.h>
44 #else
45  // nothing here yet - look in graveyard/include/portable_integers for some ideas.
46 #endif
47 
48 /*
49  * These are very naive - update these as we come across different platforms.
50  */
51 #if CHAR_MAX == INT8_MAX
52  #define ECL_SIZE_OF_CHAR 1
53 #else
54  #error "ECL_SIZE_OF_CHAR could not be determined (probably faulty ecl logic)."
55 #endif
56 #if SHRT_MAX == INT16_MAX
57  #define ECL_SIZE_OF_SHORT 2
58 #else
59  #error "ECL_SIZE_OF_SHORT could not be determined (probably faulty ecl logic)."
60 #endif
61 #if INT_MAX == INT32_MAX
62  #define ECL_SIZE_OF_INT 4
63 #else
64  #error "ECL_SIZE_OF_INT could not be determined (probably faulty ecl logic)."
65 #endif
66 #if LONG_MAX == INT32_MAX
67  #define ECL_SIZE_OF_LONG 4
68 #elif LONG_MAX == INT64_MAX
69  #define ECL_SIZE_OF_LONG 8
70 #else
71  #error "ECL_SIZE_OF_LONG could not be determined (probably faulty ecl logic)."
72 #endif
73 
74 #if LONG_LONG_MAX == INT64_MAX
75  #define ECL_SIZE_OF_LONG_LONG 8
76 #else
77  #error "ECL_SIZE_OF_LONG_LONG could not be determined (probably faulty ecl logic)."
78 #endif
79 
80 /*****************************************************************************
81 ** Floats
82 *****************************************************************************/
83 /*
84  * These may be somewhat naively assumed. I should hand craftfor
85  * particular platforms in the future if it ever really
86  * differs.
87  */
88 #ifdef __GNUC__
89  #ifdef __SIZEOF_FLOAT__
90  #define ECL_SIZE_OF_FLOAT __SIZEOF_FLOAT__
91  #else
92  #define ECL_SIZE_OF_FLOAT 4
93  #endif
94  #ifdef __SIZEOF_DOUBLE__
95  #define ECL_SIZE_OF_DOUBLE __SIZEOF_DOUBLE__
96  #else
97  #define ECL_SIZE_OF_DOUBLE 8
98  #endif
99  #ifdef __SIZEOF_LONG_DOUBLE__
100  #define ECL_SIZE_OF_LONG_DOUBLE __SIZEOF_LONG_DOUBLE__
101  #else
102  #define ECL_SIZE_OF_LONG_DOUBLE 16
103  #endif
104 #else // Non Gnu platforms
105  #define ECL_SIZE_OF_FLOAT 4
106  #define ECL_SIZE_OF_DOUBLE 8
107  #define ECL_SIZE_OF_LONG_DOUBLE 16 // This is often 12!
108 #endif
109 
110 #endif /* ECL_CONFIG_UNKNOWN_HPP_ */


ecl_config
Author(s): Daniel Stonier
autogenerated on Mon Feb 28 2022 22:16:09