[SERVER-4536] BSONObjBuilder does not handle int64_t on LP64 data model Created: 21/Dec/11 Updated: 05/Jul/16 Resolved: 09/Jun/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Client |
| Affects Version/s: | None |
| Fix Version/s: | 3.3.9 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Balint Szente | Assignee: | Mathias Stearn |
| Resolution: | Done | Votes: | 2 |
| Labels: | cxxcopy, int64_t, long, longlong, stdint | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux x86_64 / g++ |
||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Integrate+Tuning 16 (06/24/16) |
| Participants: |
| Description |
|
The following code does not compile on Linux x86_64:
Output:
The problem is that MongoDB is using long long for 64 bit values. On Linux x86_64 (LP64 data model) long is used for the int64_t and boost::int64_t types and this yields to the compilation error, where long long is not considered the same 64 bit signed type as long. Possible solutions:
I would recommend the 2nd option, because it is a clean solution. Using int, long, etc. data types might generate several unexpected issues in the future, especially when MongoDB has to be ported to various architectures. |
| Comments |
| Comment by Githook User [ 09/Jun/16 ] |
|
Author: {u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}Message: |
| Comment by Jeremy Fergason [ 13/Jul/12 ] |
|
This also fails on Linux i686 |