-
Notifications
You must be signed in to change notification settings - Fork 680
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: drop memset() calls #1139
fix: drop memset() calls #1139
Conversation
Using memset() to zero-initialize variables is kinda ugly, and not always correct. Use instead C++ and C23's empty brace list, which correctly zero-initializes any kind of object. See the following docs for reference: - <https://thephd.dev/ever-closer-c23-improvements#consistent-warningless-and-intuitive-initialization-with--> - <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2900.htm>
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #1139 +/- ##
==========================================
- Coverage 78.60% 78.44% -0.16%
==========================================
Files 53 53
Lines 6884 6875 -9
==========================================
- Hits 5411 5393 -18
- Misses 1473 1482 +9
☔ View full report in Codecov by Sentry. |
LGTM.. Except, personally, I prefer that "sizeof" always be treated (syntactically) like a function. It should take its arg in parentheses. |
Did I add new In any case, it seems that using |
Parenthesis are REQUIRED for sizeof on a TYPE, but OPTIONAL for an expression. However, the general consensus (and my personal preference) is to ALWAYS use them. However, I am not as active in pistache development as I once was, so I defer to your judgement. |
I think for consistency sake, it's a good idea to use parentheses with |
To be clear, I did not add any new Anyway, unless there are other feedbacks, this can be merged (the commitlint failure is irrelevant) |
Using
memset()
to zero-initialize variables is kinda ugly, and not always correct. Use instead C++ and C23's empty brace list, which correctly zero-initializes any kind of object.See the following docs for reference: