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

docs: example differs from its description #113

Open
hgkjshegfskef opened this issue Sep 9, 2021 · 2 comments
Open

docs: example differs from its description #113

hgkjshegfskef opened this issue Sep 9, 2021 · 2 comments

Comments

@hgkjshegfskef
Copy link
Contributor

The example at https://www.boost.org/doc/libs/1_77_0/libs/safe_numerics/doc/html/eliminate_runtime_penalty/3.html is aimed to demonstrate how different type promotion policies and exception policies can be combined. The description says:

As before, we define a type safe_t to reflect our view of legal values for this program. This uses the automatic type promotion policy as well as the loose_trap_policy exception policy to enforce elimination of runtime penalties.

But safe_t is defined as:

using safe_t = safe_signed_range<
    -24,
    82,
    native,
    loose_exception_policy
>;

According to description it should perhaps be defined as:

using safe_t = safe_signed_range<
    -24,
    82,
    automatic,
    loose_trap_policy
>;
@robertramey
Copy link
Member

Good to know that at least someone is reading the documents! Good catch. I've made the change on my local machine - let's hope that the example still compiles and runs !!!

@hgkjshegfskef
Copy link
Contributor Author

Thank you for being thorough with the documentation. While reading further, I have noticed a few more problems: e.g. some excerpts refer to boost::numeric, which I assume was the old name of the library, and things like that. Maybe I will just submit a PR to not bother you with changes. This one I just wasn't sure, since I am just learning about the library.

Re: this problem, looks like it compiles with the changes according to documentation wording: https://godbolt.org/z/EheKvPYeG

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

No branches or pull requests

2 participants