Skip to content

Conversation

@noizefloor
Copy link

core.h: buffer had virtual functions but the dtor was not virtual.

format.f: fix two sign conversions warnings

This warnings occurred on clang and gcc with -Wsign-conversion and -Wnon-virtual-dtor.

I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.

core.h: buffer had virtual functions but the dtor was not virtual.

format.f: fix two sign conversions warnings
Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

capacity_(cap) {}

~buffer() = default;
virtual ~buffer() = default;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is intentional.

Copy link
Author

Choose a reason for hiding this comment

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

Is the idea behind that to keep the vtable as small as possible? If that's the case maybe by using CRTP we could get rid of the vtable at all and satisfy my compiler ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-dtor-virtual. CRTP is not needed here, I suggest suppressing the useless warning.

// "false" for bool.
constexpr int max_size = detail::digits10<T>() + 2;
char buffer[max_size > 5 ? max_size : 5];
char buffer[max_size > 5 ? static_cast<size_t>(max_size) : 5];
Copy link
Contributor

Choose a reason for hiding this comment

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

static_cast -> to_unsigned

@vitaut
Copy link
Contributor

vitaut commented Sep 17, 2020

Partially merged in 45da432. Thanks!

@vitaut vitaut closed this Sep 17, 2020
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.

2 participants