Skip to content

Correct return type of strlen function #4

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Damien-Chen
Copy link

@Damien-Chen Damien-Chen commented Jun 29, 2025

I am confused about the return type of strlen() function.
In general, strlen() returns the length of the input string, which is always non‑negative.
Switching the return type to size_t is more accurately.

@visitorckw
Copy link
Collaborator

Thanks for the patch!
Just a couple of suggestions: the subject line of the commit message shouldn't end with a period. Also, instead of changing the return type to uint32_t, it might be more appropriate to use size_t. While Linmo currently only supports RV32 systems, using size_t makes the code more portable and could matter if we support RV64 in the future.

@Damien-Chen Damien-Chen changed the title Correct return type of strlen function. Correct return type of strlen function Jun 29, 2025
strlen() returns the length of the input string,
which is always non‑negative.
Switching the return type to size_t is more accurately.
@Damien-Chen
Copy link
Author

Hi @visitorckw,
Thanks for your feedback, I have updated new patch and squashed it into single one commit.
If there is anything need to improve, please let me know.

@visitorckw
Copy link
Collaborator

Hi @visitorckw, Thanks for your feedback, I have updated new patch and squashed it into single one commit. If there is anything need to improve, please let me know.

Thanks for the update. Next time, no need to leave a comment after pushing. GitHub will automatically notify relevant people when you push to the branch.

Copy link
Collaborator

@visitorckw visitorckw left a comment

Choose a reason for hiding this comment

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

LGTM.

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