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

Make function signature of cthreads_error_string() dependent on if the compiler supports it for better warnings. #6

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

0xfadead
Copy link
Contributor

@0xfadead 0xfadead commented Jan 20, 2025

Changes

The buf parameter is now a static VLA, if the compiler supports it, this gives better warnings if the function is used improperly (passing NULL or an array that is too short.)

Why

This improves warnings and therefore experience with CThreads.

Checkmarks

  • The modified functions have been tested.
    • Both on MSVC and GCC.
  • Used the same indentation as the rest of the project.

Additional information

THIS CHANGES THE SIGNATURE OF THIS FUNCTION!

RandomEden and others added 2 commits January 20, 2025 17:37
…er supports it

Making something a static array gives compiler warnings when the length
of the array is smaller than the provided length.
Copy link
Member

@ThePedroo ThePedroo left a comment

Choose a reason for hiding this comment

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

Looks good code-wise, but there are some syntax changes that must be done and also suggestions.

cthreads.h Outdated Show resolved Hide resolved
cthreads.c Outdated Show resolved Hide resolved
cthreads.h Outdated Show resolved Hide resolved
cthreads.h Outdated Show resolved Hide resolved
@ThePedroo ThePedroo added enhancement New feature or request confirmed This issue or pull request is confirmed to be done. labels Jan 21, 2025
@ThePedroo
Copy link
Member

(Who is RandomEden too?)

0xfadead and others added 2 commits February 3, 2025 22:02
Co-authored-by: Pedro.js <pedroolimpioguerra@gmail.com>
Signed-off-by: Awildidiot <69577313+0xfadead@users.noreply.github.com>
@0xfadead
Copy link
Contributor Author

0xfadead commented Feb 4, 2025

Why is my laptop recognised as "RandomEden" 🤣

0xfadead and others added 5 commits February 3, 2025 22:13
Co-authored-by: Pedro.js <pedroolimpioguerra@gmail.com>
Signed-off-by: Awildidiot <69577313+0xfadead@users.noreply.github.com>
Co-authored-by: Pedro.js <pedroolimpioguerra@gmail.com>
Signed-off-by: Awildidiot <69577313+0xfadead@users.noreply.github.com>
Co-authored-by: Pedro.js <pedroolimpioguerra@gmail.com>
Signed-off-by: Awildidiot <69577313+0xfadead@users.noreply.github.com>
@0xfadead 0xfadead requested a review from ThePedroo February 8, 2025 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed This issue or pull request is confirmed to be done. enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants