@@ -203,31 +203,33 @@ class JSON_API Value {
203203 static Value const & nullSingleton ();
204204
205205 // / Minimum signed integer value that can be stored in a Json::Value.
206- static const LargestInt minLargestInt;
206+ static constexpr LargestInt minLargestInt = LargestInt(~(LargestUInt(- 1 ) / 2 )) ;
207207 // / Maximum signed integer value that can be stored in a Json::Value.
208- static const LargestInt maxLargestInt;
208+ static constexpr LargestInt maxLargestInt = LargestInt(LargestUInt(- 1 ) / 2 ) ;
209209 // / Maximum unsigned integer value that can be stored in a Json::Value.
210- static const LargestUInt maxLargestUInt;
210+ static constexpr LargestUInt maxLargestUInt = LargestUInt(- 1 ) ;
211211
212212 // / Minimum signed int value that can be stored in a Json::Value.
213- static const Int minInt;
213+ static constexpr Int minInt = Int(~(UInt(- 1 ) / 2 )) ;
214214 // / Maximum signed int value that can be stored in a Json::Value.
215- static const Int maxInt;
215+ static constexpr Int maxInt = Int(UInt(- 1 ) / 2 ) ;
216216 // / Maximum unsigned int value that can be stored in a Json::Value.
217- static const UInt maxUInt;
217+ static constexpr UInt maxUInt = UInt(- 1 ) ;
218218
219219#if defined(JSON_HAS_INT64)
220220 // / Minimum signed 64 bits int value that can be stored in a Json::Value.
221- static const Int64 minInt64;
221+ static constexpr Int64 minInt64 = Int64(~(UInt64(- 1 ) / 2 )) ;
222222 // / Maximum signed 64 bits int value that can be stored in a Json::Value.
223- static const Int64 maxInt64;
223+ static constexpr Int64 maxInt64 = Int64(UInt64(- 1 ) / 2 ) ;
224224 // / Maximum unsigned 64 bits int value that can be stored in a Json::Value.
225- static const UInt64 maxUInt64;
225+ static constexpr UInt64 maxUInt64 = UInt64(- 1 ) ;
226226#endif // defined(JSON_HAS_INT64)
227-
228227 // / Default precision for real value for string representation.
229- static const UInt defaultRealPrecision;
230-
228+ static constexpr UInt defaultRealPrecision = 17 ;
229+ // The constant is hard-coded because some compiler have trouble
230+ // converting Value::maxUInt64 to a double correctly (AIX/xlC).
231+ // Assumes that UInt64 is a 64 bits integer.
232+ static constexpr double maxUInt64AsDouble = 18446744073709551615.0 ;
231233// Workaround for bug in the NVIDIAs CUDA 9.1 nvcc compiler
232234// when using gcc and clang backend compilers. CZString
233235// cannot be defined as private. See issue #486
0 commit comments