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

Replace bad arithmetic in tnt_select limit param example #3843

Closed

Conversation

sparr
Copy link
Contributor

@sparr sparr commented Nov 9, 2023

Prompted by the below compiler warning, this PR updates the doc examples and translations to replace (2^32)-1, which evaluates to 33, with UINT32_MAX which is equivalent to (1LL<<32)-1 or pow(2,32)-1 or 4294967295. This value is being used as the limit parameter to tnt_select, further explained at https://tarantool.github.io/tarantool-c/request.html#c.tnt_select as follows

limit is the number of requests to gather. For gathering all results, set limit = UINT32_MAX.

warning: result of ‘2^32’ is 34; did you mean ‘1LL << 32’? [-Wxor-used-as-pow]
 |     tnt_select(tnt[connection_number], spaceno, 0, (2^32) - 1, 0, iterator_type, tuple);
 |                                                      ^
 |                                                     --
 |                                                     1LL<<

@sparr
Copy link
Contributor Author

sparr commented Nov 9, 2023

https://github.com/ocelot-inc/ocelotgui/blob/19349c7334347eb37ef61b9694390581ea5db238/ocelotgui.cpp#L16896 is an instance of this example being copied in the wild. ocelot-inc/ocelotgui#9 is the same fix as here.

Copy link
Contributor

@andreyaksenov andreyaksenov left a comment

Choose a reason for hiding this comment

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

Thanks! Resolved conflicts in a separate PR: #4455

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.

3 participants