C++11 standard for typedefs
typedef long long int Int64; typedef unsigned long long int UInt64;
What is your opinion on updating definitions of above kind to C++11.
I'd be in favor because it's causing a serious problem with VS2013 compilations.
Doing that doesn't help. I set up the compilation based on the value of _MSC_VER in VS2013 and I still see
1>c:\NCRDev\2013\paws\paws\Json\Json\Json.h(210): error C2632: '__int64' followed by '__int64' is illegal
1>c:\NCRDev\2013\paws\paws\Json\Json\Json.h(210): warning C4091: 'typedef ' : ignored on left of '__int64' when no variable is declared
1>c:\NCRDev\2013\paws\paws\Json\Json\Json.h(519): error C2589: '__int64' : illegal token on right side of '::'
1>c:\NCRDev\2013\paws\paws\Json\Json\Json.h(519): error C2059: syntax error : '::'
1>c:\NCRDev\2013\paws\paws\Json\Json\Json.h(519): error C2632: '__int64' followed by '__int64' is illegal
1>c:\NCRDev\2013\paws\paws\Json\Json\Json.h(519): error C2238: unexpected token(s) preceding ';'
Some of that comes from
#if defined(JSON_HAS_INT64)
typedef Json::UInt64 UInt64;
typedef Json::Int64 Int64;
#endif // defined(JSON_HAS_INT64)
Sent from my iPhone
On Sep 29, 2015, at 8:18 AM, jbmonroe [email protected] wrote:
I'd be in favor because it's causing a serious problem with VS2013 compilations.
Can you be more specific? What's the problem caused by the tyoedefs?
— Reply to this email directly or view it on GitHub.
it looks like there's an unanticipated macro definition of "UInt64" somewhere.
Sent from my iPhone
On Sep 29, 2015, at 8:34 AM, jbmonroe [email protected] wrote:
Doing that doesn't help. I set up the compilation based on the value of _MSC_VER in VS2013 and I still see
1>c:\NCRDev\2013\paws\paws\Json\Json\Json.h(210): error C2632: '__int64' followed by '__int64' is illegal 1>c:\NCRDev\2013\paws\paws\Json\Json\Json.h(210): warning C4091: 'typedef ' : ignored on left of '__int64' when no variable is declared 1>c:\NCRDev\2013\paws\paws\Json\Json\Json.h(519): error C2589: '__int64' : illegal token on right side of '::' 1>c:\NCRDev\2013\paws\paws\Json\Json\Json.h(519): error C2059: syntax error : '::' 1>c:\NCRDev\2013\paws\paws\Json\Json\Json.h(519): error C2632: '__int64' followed by '__int64' is illegal 1>c:\NCRDev\2013\paws\paws\Json\Json\Json.h(519): error C2238: unexpected token(s) preceding ';' Some of that comes from
#if defined(JSON_HAS_INT64) typedef Json::UInt64 UInt64; typedef Json::Int64 Int64; #endif // defined(JSON_HAS_INT64) — Reply to this email directly or view it on GitHub.
Json::Value adds its own versions of the typedefs. I highlighted those above. So at ~216, we see
// For Microsoft Visual use specific types as long long is not supported
#if defined(_MSC_VER) // Microsoft Visual Studio
#if _MSC_VER > 1700
typedef long long Int64;
typedef unsigned long long UInt64;
#else
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
#endif
Then at ~517 we see (inside class JSON_API Value)
#if defined(JSON_HAS_INT64)
typedef Json::UInt64 UInt64;
typedef Json::Int64 Int64;
#endif // defined(JSON_HAS_INT64)
What's the benefit to using typedef again?
If one includes Json.h before Windows.h the issue goes away. Unfortunately that requires putting it in stdafx.h for the project, which wouldn't be my first preference.
Windows.h should not have defined this macro. Ugh!
Anyway, maybe we can do something about this. E.g.
#ifdef Int64
#undef Int64
#endif
That's not likely to harm anyone.
Please provide github links to actual tree objects. We need to see SHA1s. I do not see the following on either master or 0.y.z branch tips:
#if _MSC_VER > 1700
Did you modify 1700 for your own testing?
Yeah, there was no test there at all. I was trying to set a threshold for versions of the compiler that will allow 'long long' as a type.
In the end I just moved the header file up above Windows.h and moved on. I'll play with the undef idea, though, but I'll still gate it according to the compiler version.
(That'll take a back seat to actually getting the demo running while the customer is in the house, though!)
(That'll take a back seat to actually getting the demo running while the customer is in the house, though!)
:sake:
Haha! Yes!
When you have a PR ready, you can reference this closed issue.
Dear cdunn2001, so are we planning to use standard c++11 for these declarations ?
@armandology, unfortunately, we cannot change symbols. That would not be backward compatible in the binary sense. But typedef-ing the current symbols to something of the same number of bits is fine.
Also, C++11 is available on the master branch (for versions 1.y.z). Just be aware that it's not available on 0.y.z.
Hi Chris, exactly thats what I meant, since master (1.y.z branch) is C++11 so would it be possible to change declaration of typedef as int64_t instead of long long. They are both 64 bit but since int64_t is the C++11 standard so shouldn’t JSONCPP move onto following the c++11 standards ?
On Oct 1, 2015, at 6:12 PM, Christopher Dunn [email protected] wrote:
@armandology https://github.com/armandology, unfortunately, we cannot change symbols. That would not be backward compatible in the binary sense. But typedef-ing the current symbols to something of the same number of bits is fine.
Also, C++11 is available on the master branch (for versions 1.y.z). Just be aware that it's not available on 0.y.z.
— Reply to this email directly or view it on GitHub https://github.com/open-source-parsers/jsoncpp/issues/370#issuecomment-144863756.
I'm fine with int64_t, but I don't know whether it would break some compilers. I guess we could try it and simply revert if there is a complaint.