Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix examples in user guide using deprecated DoNotOptimize-API #1568

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 2 commits into from
Mar 7, 2023

Conversation

mjacobse
Copy link
Contributor

@mjacobse mjacobse commented Mar 7, 2023

The const-reference API to DoNotOptimize was deprecated with #1493. Some examples in the user guide are using exactly that deprecated interface. This fixes that by passing non-const lvalues instead. Fixes #1566

I tried to provide a brief comment explaining why a copy is passed to DoNotOptimize. I opted to do so only in the section that addresses the DoNotOptimize feature directly, to not clutter the examples that highlight other aspects too much. I do wonder whether a more elaborate explanation in the "Preventing Optimization" section might be warranted, but perhaps that is for another PR?

mjacobse added 2 commits March 7, 2023 15:00
The const-reference API to DoNotOptimize was deprecated with google#1493. Some
examples in the user guide are using exactly that deprecated interface.
This fixes that by passing non-const lvalues instead. Fixes google#1566
@dmah42 dmah42 merged commit f23fedb into google:main Mar 7, 2023
@dmah42
Copy link
Member

dmah42 commented Mar 7, 2023

thanks!

@mjacobse mjacobse deleted the fix_deprecated_donotoptimize_examples branch March 7, 2023 14:49
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.

[BUG] Examples from User Guide trigger deprecation warning for const-reference DoNotOptimize
2 participants