-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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 some issues found by cppcheck. #59911
Conversation
@@ -51,7 +51,7 @@ ScriptIterator::ScriptIterator(const String &p_string, int p_start, int p_length | |||
} | |||
|
|||
int paren_size = PAREN_STACK_DEPTH; | |||
ParenStackEntry *paren_stack = (ParenStackEntry *)memalloc(paren_size * sizeof(ParenStackEntry)); | |||
ParenStackEntry *paren_stack = static_cast<ParenStackEntry *>(memalloc(paren_size * sizeof(ParenStackEntry))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record, what are the kind of issues with using a C-style cast instead of static_cast
or dynamic_cast
in this context that cppcheck would report?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cppcheck
reports all C-casts, I guess the only purpose of these reports is to make intention of the cast more clear, so it's just a style change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good so far.
dc98130
to
3620e92
Compare
Looked at the rest of report, and added more fixes (but it's definitely not everything):
|
Thanks! |
Fix some issues found by https://calinou.github.io/godot-cppcheck/master/