Skip to content

Change points.size() to size() to make transition to index_t easier #4190

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

Merged
merged 41 commits into from
Jul 13, 2020

Conversation

kunaltyagi
Copy link
Member

No description provided.

@kunaltyagi kunaltyagi added needs: code review Specify why not closed/merged yet priority: gsoc Reason for prioritization labels Jun 15, 2020
@kunaltyagi
Copy link
Member Author

Needs testing for GPU and CUDA modules

@kunaltyagi kunaltyagi marked this pull request as ready for review June 16, 2020 06:51
Copy link
Member

@SergioRAgostinho SergioRAgostinho left a comment

Choose a reason for hiding this comment

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

Partial (33/357)

@kunaltyagi
Copy link
Member Author

Issues remaining to discuss (repeating because of GitHub's awesome interface):

  • Format strings:
    • We might need explicit casts to comply with the format strings
    • index_t might change, so... what to do about them?
  • removing redundant casts
  • sprinkling auto

Issues split off from this PR: #4212, #4213, #4214

PR split off from here: #4216

@SergioRAgostinho
Copy link
Member

Format strings:

  • We might need explicit casts to comply with the format strings

  • index_t might change, so... what to do about them?

I'm not very experienced with string manipulation in C++. This is what I considered

  1. We explicitly cast to uint64_t (since we're guaranteed that the number represented will always be positive) and we'll always be able to print the corresponding number. Simple. I'm just unsure if there are meaningful performance penalties.
  2. We ignore formatting entirely and use a string stream to build the string. I suspect this is slow.
  3. We use boost format and transition to std::format in C++20.

Copy link
Member

@SergioRAgostinho SergioRAgostinho left a comment

Choose a reason for hiding this comment

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

Partial (119/357). We should address all for-range conversions here. It will suppress three problems in one a single place:

  • no direct use of points.size() or even size() for that matter
  • no need to know the return type of size()
  • no issues with potential range limit of the index type used.

@kunaltyagi
Copy link
Member Author

kunaltyagi commented Jun 24, 2020

125 instances of cast found and replaced using

grep 'width\s*=.*(.*size\s*()\s*)' * -nrl | xargs -n1 sed -i 's,\(width\s*=\s*\).*(\(.*size\s*()\)\s*),\1\2,g'

@kunaltyagi kunaltyagi added needs: more work Specify why not closed/merged yet and removed needs: code review Specify why not closed/merged yet labels Jun 24, 2020
@kunaltyagi kunaltyagi force-pushed the points.size branch 6 times, most recently from e36e70b to 4b3a9ed Compare June 25, 2020 00:43
@kunaltyagi kunaltyagi added the needs: feedback Specify why not closed/merged yet label Jun 25, 2020
@SergioRAgostinho
Copy link
Member

Answering #4190 (comment)

Isn't floor(x) same as ceil(x) - 1, regardless of sign of x?

No. The corner case is when x is a natural number.

x = 2
floor(x) -> 2
ceil(x) - 1 -> 1

Copy link
Member

@SergioRAgostinho SergioRAgostinho left a comment

Choose a reason for hiding this comment

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

Partial (128/371). Be very conservative with your force-pushes. This last one you did offset my review progress by 50 files.

Copy link
Member

@SergioRAgostinho SergioRAgostinho left a comment

Choose a reason for hiding this comment

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

Partial (213/371)

@kunaltyagi
Copy link
Member Author

So much more work left.... sigh

Regarding casts, I don't see a point in replacing the casts now and adding them later when the loop index variable is changed to index_t

@kunaltyagi
Copy link
Member Author

Addressing conflicts too

Copy link
Member

@SergioRAgostinho SergioRAgostinho left a comment

Choose a reason for hiding this comment

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

If you addressed all the items, this is good to go from my side.

@kunaltyagi
Copy link
Member Author

I did. Please approve and merge 😄

@SergioRAgostinho SergioRAgostinho merged commit 009d73d into PointCloudLibrary:master Jul 13, 2020
@kunaltyagi kunaltyagi deleted the points.size branch July 13, 2020 16:27
SunBlack pushed a commit to SunBlack/pcl that referenced this pull request Oct 27, 2020
…ral fixes:

* Fix warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Wimplicit-exception-spec-mismatch] RealSense2Grabber::~RealSense2Grabber ()
* Fix error: use of undeclared identifier 'size' (introduced in PointCloudLibrary#4190)
* Fix error: variable 'cloud_texture_ptr' must have explicitly specified data sharing attributes
SunBlack pushed a commit to SunBlack/pcl that referenced this pull request Oct 27, 2020
…ral fixes:

* Fix warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Wimplicit-exception-spec-mismatch] RealSense2Grabber::~RealSense2Grabber ()
* Fix error: use of undeclared identifier 'size' (issue introduced in PointCloudLibrary#4190)
* Fix error: variable 'cloud_texture_ptr' must have explicitly specified data sharing attributes
SunBlack pushed a commit to SunBlack/pcl that referenced this pull request Oct 27, 2020
…ral fixes:

* Fix warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Wimplicit-exception-spec-mismatch] RealSense2Grabber::~RealSense2Grabber ()
* Fix warning: comparison of integers of different signs: 'int' and 'std::size_t'
* Fix error: use of undeclared identifier 'size' (issue introduced in PointCloudLibrary#4190)
* Fix error: variable 'cloud_texture_ptr' must have explicitly specified data sharing attributes
SunBlack pushed a commit to SunBlack/pcl that referenced this pull request Oct 27, 2020
…ral fixes:

* Fix warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Wimplicit-exception-spec-mismatch] RealSense2Grabber::~RealSense2Grabber ()
* Fix warning: comparison of integers of different signs: 'int' and 'std::size_t'
* Fix error: use of undeclared identifier 'size' (issue introduced in PointCloudLibrary#4190)
* Fix error: variable 'cloud_texture_ptr' must have explicitly specified data sharing attributes
SunBlack pushed a commit to SunBlack/pcl that referenced this pull request Oct 27, 2020
…ral fixes:

* Fix warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Wimplicit-exception-spec-mismatch] RealSense2Grabber::~RealSense2Grabber ()
* Fix warning: comparison of integers of different signs: 'int' and 'std::size_t'
* Fix error: use of undeclared identifier 'size' (issue introduced in PointCloudLibrary#4190)
* Fix error: variable 'cloud_texture_ptr' must have explicitly specified data sharing attributes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: code review Specify why not closed/merged yet needs: more work Specify why not closed/merged yet priority: gsoc Reason for prioritization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants