-
Notifications
You must be signed in to change notification settings - Fork 79
fix: strlen is not constexpr #354
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
fix: strlen is not constexpr #354
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@proxict did you check all usages of these strings also ? |
I still want to go through the repository and replace I hope it's okay like that, it's my first PR to this project, I believe :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a standards compliance issue by converting string literal declarations from pointers to arrays, enabling the use of sizeof instead of the non-standard strlen() in constexpr contexts.
- Converts all string literal declarations from
const char*toconst char[] - Replaces
strlen()withsizeof() - 1for compile-time length calculation ofT__gz
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I just checked all occurrences of these variables and replaced |
Defining the string literals as char arrays instead of letting them decay to pointers allows us to use `sizeof` instead of `strlen()` to get the length of string literals.
a57cdf1 to
ac4c378
Compare
Defining the string literals as char arrays instead of letting them decay to pointers allows us to use
sizeofinstead ofstrlen()to get the length of string literals.The project compiles with
strlen()used in theconstexprcontext only thanks to compiler extensions, but it's not standard compliant.