Skip to content

Conversation

@proxict
Copy link

@proxict proxict commented Dec 6, 2025

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.

The project compiles with strlen() used in the constexpr context only thanks to compiler extensions, but it's not standard compliant.

@coderabbitai
Copy link

coderabbitai bot commented Dec 6, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mathieucarbou
Copy link
Member

@proxict did you check all usages of these strings also ?
Thanks for the pr!

@proxict
Copy link
Author

proxict commented Dec 6, 2025

@proxict did you check all usages of these strings also ? Thanks for the pr!

I still want to go through the repository and replace strlen()s for these variables with sizeof. But I wanted to see the CI output first to make sure this commit doesn't break anything (I have tried a local build, but only for one platform).

I hope it's okay like that, it's my first PR to this project, I believe :-)

Copy link

Copilot AI left a 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* to const char[]
  • Replaces strlen() with sizeof() - 1 for compile-time length calculation of T__gz

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@proxict
Copy link
Author

proxict commented Dec 6, 2025

I just checked all occurrences of these variables and replaced strlen() with sizeof() - 1 where possible.

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.
@mathieucarbou mathieucarbou force-pushed the fix/strlen-not-constexpr branch from a57cdf1 to ac4c378 Compare December 8, 2025 13:42
@mathieucarbou mathieucarbou merged commit d7bbff6 into ESP32Async:main Dec 8, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants