Skip to content
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

refactor(1089): update index types from int to size_t #1090

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NickUfer
Copy link
Contributor

@NickUfer NickUfer commented Dec 3, 2024

Fixes #1089

@NickUfer NickUfer marked this pull request as ready for review December 3, 2024 22:24
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.89%. Comparing base (fb29e85) to head (af68c57).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1090      +/-   ##
==========================================
+ Coverage   91.87%   91.89%   +0.01%     
==========================================
  Files          30       30              
  Lines        5882     5882              
==========================================
+ Hits         5404     5405       +1     
+ Misses        478      477       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@NickUfer NickUfer marked this pull request as draft December 3, 2024 22:30
refactor(1089): change NumProp getter type to int
@NickUfer NickUfer marked this pull request as ready for review December 3, 2024 22:59
@@ -270,7 +270,7 @@ class Manifold {
size_t NumVert() const;
size_t NumEdge() const;
size_t NumTri() const;
size_t NumProp() const;
int NumProp() const;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you want to turn this into int?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the right thing is to update that to size_t rather than vice-versa.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I thought about trying a simpler refactor, but if you say it is fine to change that to size_t, I'll do that later 😄

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly beats changing our public API 😄

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we have things that are not yet size_t but probably should be. They are mostly internal, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into this more today and I'm pretty sure changing numProp to size_t will not only change this field, but alot of other fields, structs, variables in methods and the public api too. I also found many other places where size_t and int are mismatched in parameter or variable types or int is used as vector index access where the vector size is type size_t.

My idea of going forward with this:

  • I remove the numProp change from this PR
  • We merge this PR with only the changes I mentioned in the issue
  • I finish the rust bindings
  • I come back to afterwards and try to rectify the size_t problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent use of int and size_t in C Bindings for std::vector Types
3 participants