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

Using FMT_NULLPTR instead of literal 0 #409

Merged
merged 1 commit into from
Nov 3, 2016
Merged

Conversation

alabuzhev
Copy link
Contributor

Based on issue 408

I've added FMT_NULLPTR macro (similar to other emulated language features there) that would expand to NULL or nullptr if available, as gcc isn't happy even with NULL in some cases.

Also added a couple of FMT_OVERRIDE where necessary.

@@ -748,7 +758,7 @@ void MemoryBuffer<T, SIZE, Allocator>::grow(std::size_t size) {
std::size_t new_capacity = this->capacity_ + this->capacity_ / 2;
if (size > new_capacity)
new_capacity = size;
T *new_ptr = this->allocate(new_capacity);
Copy link
Contributor

Choose a reason for hiding this comment

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

You've added a second argument here for some reason that causes compilation errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See http://en.cppreference.com/w/cpp/memory/allocator/allocate
Second argument is defaulted to literal 0 and causes a warning when -Wzero-as-null-pointer-constant diagnostic enabled.

I presume compilation error happens in mock-allocator.h?
If so, just adding a dummy parameter to its allocate() will fix that (and also will make that mock more conformant).

@vitaut
Copy link
Contributor

vitaut commented Nov 3, 2016

Nice! Thanks for working on it (and @foonathan for reviewing).

@vitaut vitaut merged commit 49ccb2e into fmtlib:master Nov 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants