Java vs c++ types
I've recently had a question about coledatetime java implementation, and Chris said, that the problem might lay in type conversions: cpp-float vs java-float (Or maybe cpp-date vs java-date. Not types, but..). Now I have several questions on this:
- Is there a table of comparison for java vs c++ types?
- If type conversions is the problem, in my situation (I have a db with OLEDate records, alread开发者_开发知识库y created with some c++ program. I need to read and write to that db, so that the OLEDate field compatibility remained: my java code reads proper dates, and c++ program is not affected with what the java program wrote to the db.), what would you do:
- Use COleDateTime to retrieve the date with JNI?
- Create your own implementation at all costs (using broader types, or anything else)?
- Is there anything, I'm missing here?
In c++ type ranges can and do differ from one implementation (compiler/architecture) to another, so there is no standard Java-C++ type comparisons as there is no standard C++ type sizes.
But in most current architectures C++ doubles are standard IEEE 754 doubles, as it is in Java. So while the code will not be strictly portable to some rare architecture, it will more often than not work in any x86/x86_64 architectures.
There was a question in the comments of the previous answer that you did not address: what is it that does not work in the implementation you have?
精彩评论