-
Notifications
You must be signed in to change notification settings - Fork 97
feat: Missed std::map #3877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Missed std::map #3877
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3877 +/- ##
===========================================
- Coverage 58.82% 58.82% -0.01%
===========================================
Files 1321 1321
Lines 108923 108924 +1
===========================================
Hits 64077 64077
- Misses 44846 44847 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| string_array const & setNames = fs.getSetNames(); | ||
| for( size_t i = 0; i < setNames.size(); ++i ) | ||
| { | ||
| isTargetSetCreated[setNames[i]] = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| isTargetSetCreated[setNames[i]] = 0; | |
| isTargetSetCreated.get_inserted( setNames[i] ) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My question is, how the isTargetSetCreated map gets populated if only the operator[] is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed we must set the getInserted() method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the question it brings: as geos::stdMap::operator[] is only for getting map elements and should throw an error if bound checking is enabled, how can that pass the tests?
if there is a deeper issue, it will need another PR @arng40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine, for the moment isTargetSetCreated is a map and not a stdMap that's why the CI is running and ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal was to toggle geos::map between geos::stdMap and std::map. So we would always use geos::map in the code and get either behavior depending on the USE_STD_CONTAINER_BOUNDS_CHECKING/GEOS_USE_BOUNDS_CHECK is on. It seems we have a couple of inconsistencies here? Likewise for geos::unordered_map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no "std bounds checking" on std map containers, std::*map::operator[] creates elements, this forces us to have a wrapper over std map classes. At this point I think we can just merge geos::stdMap and geos::map, and it will be configurable with GEOS_USE_BOUNDS_CHECK
- when
true, geos maps will throw proper exception/error when trying to access non-existing element throughoperator[], as planned in the draft, - when
false, geos maps will just silently create new elements for non-existing elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MelReyCG Yes, I am aware of that. I am pointing out that the std container wrappers that we are creating should not be directly used. If GEOS_USE_BOUNDS_CHECK then we use them. If not, then we use the actual std containers. This should be done via an alias that is protected via the preprocessor guards on GEOS_USE_BOUNDS_CHECK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About consistency, should we have a geos::vector then? (we now use geos::stdVector everywhere)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are a few redondancies for now in this GEOS_USE_BOUNDS_CHECK behaviour (around the types/operators).
|
@wrtobin Here you have a typical instance of the current issue of GEOS error handling. The Ubuntu 22.04, clang 15.0.7, open-mpi 4.1.2 crashed, and here is all the log we get: No reason, no stacktrace, and no way to add info. |
| string_array const & setNames = fs.getSetNames(); | ||
| for( size_t i = 0; i < setNames.size(); ++i ) | ||
| { | ||
| isTargetSetCreated[setNames[i]] = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal was to toggle geos::map between geos::stdMap and std::map. So we would always use geos::map in the code and get either behavior depending on the USE_STD_CONTAINER_BOUNDS_CHECKING/GEOS_USE_BOUNDS_CHECK is on. It seems we have a couple of inconsistencies here? Likewise for geos::unordered_map.
…r.cpp Co-authored-by: MelReyCG <[email protected]>
No description provided.