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

Documentation #10

Merged
merged 11 commits into from
Aug 16, 2024
Merged

Documentation #10

merged 11 commits into from
Aug 16, 2024

Conversation

dabrahams
Copy link
Contributor

No description provided.

- `message`: an expression convertible to `const char*` pointing to a
[null-terminated](https://en.cppreference.com/w/cpp/string/byte)
message that is additionally passed to the violation handler. The
default value is the empty string, `""`.
Copy link
Member

@sean-parent sean-parent Aug 16, 2024

Choose a reason for hiding this comment

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

Is nullptr allowed for the message? In a macro I believe we can force a string literal by using "" message.

Copy link
Contributor Author

@dabrahams dabrahams Aug 16, 2024

Choose a reason for hiding this comment

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

Does nullptr point to a null-terminated byte string? I think not.

In a macro I believe we can force a string literal by using "" message.

I don't understand what you're suggesting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sean-parent I get it now. But why would we want to do that?

Copy link
Member

Choose a reason for hiding this comment

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

By ensuring a string literal, you don't have to deal with null and lifetime if it escapes (on the down side, you can't build a message at runtime).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can only escape if you return or throw from your handler. Are you sure it's worth it? People can do any number of other bad things in their handlers too.

README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
Copy link
Member

@sean-parent sean-parent left a comment

Choose a reason for hiding this comment

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

I left comments for requested changes.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@dabrahams dabrahams merged commit c0d6e85 into main Aug 16, 2024
15 checks passed
@fosterbrereton fosterbrereton deleted the documentation branch August 26, 2024 17:19
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.

2 participants