when to use std::int32_t and std::int64_t
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 45
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
Description
Looks like there have been some conversations around this and thought we should discuss all the places where we need to be explicit about the bit size of the int and when we shouldn't. I'll start us off with refs to previous conversations and lists of our current int32_t and int64_t usage. It would be great to get some follow-up comments about the reasoning behind this.
It looks like the idea is that we want to use int32_t for x, y, z, and extent until we cast them to doubles or int64_ts when we store them in a mapbox::geometry::point. Looks like we use int64_t for id and property values, referred to as v in the code.
References
- https://github.com/mapbox/vtquery/pull/95#discussion_r198340002
- https://github.com/mapbox/vtquery/pull/88
- https://github.com/mapbox/vtquery/pull/89
int32_t/ uint32_t usage
create_query_point- https://github.com/mapbox/vtquery/blob/master/src/util.hpp#L54-L57convert_vt_to_ll- https://github.com/mapbox/vtquery/blob/master/src/util.hpp#L84-L87TileObject- https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L64-L66 & https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L93-L95QueryData- https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L102 & https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L128Execute- https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L278 & https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L301-L304HandleOKCallback- https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L433NAN_METHOD(vtquery)- https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L507-L536 & https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L605-L613 & https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L651
int64_t/ uint64_t usage
mapbox::util::variant- https://github.com/mapbox/vtquery/blob/master/src/util.hpp#L40create_query_point- https://github.com/mapbox/vtquery/blob/master/src/util.hpp#L52 & https://github.com/mapbox/vtquery/blob/master/src/util.hpp#L68-L78convert_vt_to_ll- https://github.com/mapbox/vtquery/blob/master/src/util.hpp#L89ResultObject- https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L44property_value_visitor- https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L144-L147insert_result- https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L201Execute- https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L306 & https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L317
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the prior discussions in pull requests 95, 88, and 89, then inspect the listed integer usages in src/util.hpp and src/vtquery.cpp. Done means reaching agreement on when each integer width should be used and documenting or applying the resulting decision across the referenced functions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api, backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100