Allow for larger integer values to be printed correctly#82
Allow for larger integer values to be printed correctly#82eddelbuettel wants to merge 3 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses the issue where verbose printing mode uses incorrect format specifiers for potentially large integer values. The changes cast node counts and indices to size_t before printing, ensuring proper formatting of values larger than 32-bit integers.
Key Changes:
- Updated three
annoylib_showUpdatecalls to cast integer values tosize_t - Modified format specifiers from
%dto%lud(though this is incorrect - should be%zu) - Updated ChangeLog to document the changes
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| inst/include/annoylib.h | Updates three verbose print statements to cast template parameter values to size_t with modified format specifiers |
| ChangeLog | Documents the changes to support printing larger integer indices |
Note: The format specifier %lud used in all three changes is incorrect. The correct format specifier for size_t is %zu, which is already used correctly elsewhere in this codebase (lines 1138, 1197, 1328).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
CLosed in favour of #81. |
PR #81 notes that the print function used in verbose mode defaults to '%d' yet the templates may be instantiated with integers of larger capacity than the four-byte
intakaint32_twe default to.So this PR changes this to print as '%zu' with a corresponding cast to
size_t.