[SERVER-10568] SafeNum should be written in terms of explicitly sized types like int32_t and int64_t Created: 19/Aug/13 Updated: 22/Feb/16 Resolved: 08/Feb/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code, Portability |
| Affects Version/s: | None |
| Fix Version/s: | 3.3.2 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Andrew Morrow (Inactive) | Assignee: | Waley Chen |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Operating System: | ALL |
| Sprint: | Platforms 10 (02/19/16) |
| Participants: |
| Description |
|
The current implementation of SafeNum makes unwarranted assumptions about the sizes of the integral types 'int' and 'long long int'. Since SafeNum is explicitly intended to model signed 32-bit and signed 64-bit integers, its interface and implementation should be re-written in terms of the appropriate fixed width integer types: int32_t and int64_t. |
| Comments |
| Comment by Githook User [ 08/Feb/16 ] |
|
Author: {u'username': u'WaleyChen', u'name': u'Waley', u'email': u'waley.chen@10gen.com'}Message: |
| Comment by Waley Chen [ 08/Feb/16 ] |
|
master@e34706733411e42dba63826a10b15f81e13fdd0d |
| Comment by Andrew Morrow (Inactive) [ 25/Jan/16 ] |
|
Perhaps. However, SafeNum is used only in the mutable BSON and update framework, so it has limited scope. There should only be a few places where it needs to interact with the widespread use of 'long long' and 'int'. I think it is worth investigating. |
| Comment by Andy Schwerin [ 25/Jan/16 ] |
|
This will be a lot of trouble, since most of MongoDB is written to use int for int32 and long long for int64. On Linux, the type of int64_t is long. This leads to all sorts of problems with function overloads. Good luck, but I think doing this in isolation from fixing all other uses of long long is going to make the code harder to read. |