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

Add parentheses around use of zerouuid macro #371

Merged
merged 1 commit into from
Jan 9, 2019

Conversation

jacobperron
Copy link
Member

Otherwise the preprocessor may gobble up the commas in mistake of extra parameters when it is passed to uuidcmpzero.
cppcheck v1.86 was complaining about this line.

Otherwise the preprocessor may gobble up the commas in mistake of extra parameters when it is passed to uuidcmpzero.
cppcheck v1.86 was complaining about this line.
@jacobperron jacobperron added bug Something isn't working in progress Actively being worked on (Kanban column) labels Jan 9, 2019
@jacobperron
Copy link
Member Author

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@jacobperron jacobperron added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Jan 9, 2019
@@ -57,7 +57,7 @@ extern "C"
#define UUID_SIZE 16
#define uuidcmp(uuid0, uuid1) (0 == memcmp(uuid0, uuid1, UUID_SIZE))
#define zerouuid (uint8_t[UUID_SIZE]) {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define uuidcmpzero(uuid) uuidcmp(uuid, zerouuid)
#define uuidcmpzero(uuid) uuidcmp(uuid, (zerouuid))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any particular reason to make this (and uuidcmp above) macros? It seems like they can just as easily be done as functions, and then you'd get type-checking and no weird pre-processor things either.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't recall a particular reason. I guess because it was more terse this way.

@jacobperron jacobperron merged commit ecc3cb5 into master Jan 9, 2019
@jacobperron jacobperron deleted the bug_missing_paren branch January 9, 2019 23:50
@jacobperron jacobperron removed the in review Waiting for review (Kanban column) label Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants