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

Don't use array size in function arguments #1269

Merged
merged 1 commit into from
Aug 31, 2023
Merged

Conversation

proski
Copy link
Contributor

@proski proski commented Feb 25, 2023

The declaration of argv_to_string() mismatched its definition. The definition had the array size, the declaration had not. Remove array sizes from all functions declared in argv.h.

Array sizes in function arguments don't ensure the code correctness but can give a wrong impression that the compiler would check the array size.

The declaration of argv_to_string() mismatched its definition. The
definition had the array size, the declaration had not. Remove array sizes
from all functions declared in argv.h.

Array sizes in function arguments don't ensure the code correctness but can
give a wrong impression that the compiler would check the array size.
@proski
Copy link
Contributor Author

proski commented Feb 25, 2023

I've checked that the code does correct checks for the argv size. The argv_to_* functions look for the NULL terminator. The argv_from_* functions fail if the resulting NULL terminated array would exceed SIZEOF_ARG in size. Both looks correct to me.

This is a very visible warning detected with -Wall both by gcc and clang. It's about time that we fix it so that -Wall can be enabled in all builds by default.

@koutcher
Copy link
Collaborator

LGTM, thanks.

@koutcher koutcher merged commit 2406676 into jonas:master Aug 31, 2023
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