-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
cleaned up some array length related code #7283
base: main
Are you sure you want to change the base?
Conversation
test/helpers.h
Outdated
@@ -246,4 +246,6 @@ struct LibraryHelper | |||
static Library::Error loadxmldoc(Library &lib, const tinyxml2::XMLDocument& doc); | |||
}; | |||
|
|||
#define ARRAY_LEN(x) sizeof(x) / sizeof(x[0]) |
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.
Can't we use std::size()
?
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.
That is not available until C++17.
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.
Oh jeez. Time to update... to C++20.
@@ -466,42 +466,42 @@ class TestCmdlineParser : public TestFixture { | |||
void nooptions() { | |||
REDIRECT; | |||
const char * const argv[] = {"cppcheck"}; | |||
ASSERT_EQUALS_ENUM(CmdLineParser::Result::Exit, parser->parseFromArgs(1, argv)); |
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.
Since this is used in so many tests, maybe there should be a template overload that deduces the size?
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.
Yes, using a helper which does that would be better.
dfa20f1
to
e2f4223
Compare
No description provided.