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

Fix MSVC warning about mismatched sizes. #2

Merged
merged 3 commits into from
Feb 19, 2014
Merged

Fix MSVC warning about mismatched sizes. #2

merged 3 commits into from
Feb 19, 2014

Conversation

ahmedcharles
Copy link
Contributor

No description provided.

@mclow
Copy link
Contributor

mclow commented Feb 19, 2014

A simple fix, and it certainly doesn't break anything on my system.

But, but - the code there is somewhat obscure, using || for flow control.
How about using something like this instead?

       streamsize npad = os.width() <= 0  ? 0 :
                     (bitsetsize_type) os.width() <= b.size() ? 0 : os.width() - b.size();

or even:

       size_t npad = std::max(os.width(), 0);
       if ( b.size() < npad )
                  npad -= b.size();

Along the lines of "leaving the code cleaner than when you found it".

@ahmedcharles
Copy link
Contributor Author

I didn't even notice that the expression was that complex. I'll take another look.

@ahmedcharles
Copy link
Contributor Author

This should be easier to understand.

@mclow
Copy link
Contributor

mclow commented Feb 19, 2014

I like that much better. Thanks!
Do you want me to merge it, or will you?

@ahmedcharles
Copy link
Contributor Author

I should probably create a merge point between develop and master first, just realized that there isn't one.

@mclow
Copy link
Contributor

mclow commented Feb 19, 2014

I'd appreciate that.

@ahmedcharles
Copy link
Contributor Author

I also can't merge it since I don't have permissions.

mclow added a commit that referenced this pull request Feb 19, 2014
Fix MSVC warning about mismatched sizes.
@mclow mclow merged commit 20df4ea into boostorg:develop Feb 19, 2014
@ahmedcharles ahmedcharles deleted the patch-1 branch February 19, 2014 06:49
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