Skip to content

Create ellipses-and-variadic-templates.md #35

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

Merged
merged 1 commit into from
Jun 12, 2017
Merged

Create ellipses-and-variadic-templates.md #35

merged 1 commit into from
Jun 12, 2017

Conversation

yves-dolce
Copy link
Contributor

I guess it's often making a difficult choice between making the code sample as simple as possible to convey the informative or taking the risk of using C++ features that make the example more obscure than it needs to be. :-)
However, there's also the risk of transmitting information that's copy/pasted again and again when there is a better way to write it in "modern" C++ that all descent compilers support in 2017. That's why I believe:

  1. constexpr should be used here instead of const.
  2. The size in bytes of the type (size_t) will be different on x86 and x64 so auto (or size_t) would be recommended.
  3. Using uniform initialization as it doesn't allow you to implicitly narrow a type into another type: useful here if you'd have compiled under x64 and assigned to an unsigned (32-bit) type.

I guess it's often making a difficult choice between making the code sample as simple as possible to convey the informative or taking the risk of using C++ features that make the example more obscure than it needs to be. :-)
However, there's also the risk of transmitting information that's copy/pasted again and again when there is a better way to write it in  "modern" C++ that all descent compilers support in 2017. That's why I believe:
1. constexpr should be used here instead of const.
2. The size in bytes of the type (size_t) will be different on x86 and x64 so auto (or size_t) would be recommended.
3. Using uniform initialization as it doesn't allow you to implicitly narrow a type into another type: useful here if you'd have compiled under x64 and assigned to an unsigned (32-bit) type.
@msftclas
Copy link

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

Copy link
Contributor

@mikeblome mikeblome left a comment

Choose a reason for hiding this comment

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

thanks yes agreed on all points!

@mikeblome mikeblome merged commit 9949644 into MicrosoftDocs:master Jun 12, 2017
@yves-dolce yves-dolce deleted the patch-2 branch June 12, 2017 20:45
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.

4 participants