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

Annotate functions with [[lifetimebound]] attribute where applicable. #46

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

zrax
Copy link
Owner

@zrax zrax commented Jan 10, 2025

Resolves #45

@@ -95,13 +95,13 @@ namespace _ST_PRIVATE
}

ST_NODISCARD
inline const char *find_cs(const char *haystack, size_t size, char ch)
inline const char *find_cs(const char *haystack ST_LIFETIME_BOUND, size_t size, char ch)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just checking, these annotations are intentionally on the parameter and not on the method?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes, the return parameter is a reference to the same block of memory as the haystack variable.

@zrax zrax merged commit 42e68a9 into master Jan 10, 2025
18 checks passed
@zrax zrax deleted the lifetimebound branch January 10, 2025 20:58
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.

Lifetime-bound annotations for methods returning pointers to internal buffers
2 participants