Skip to content

Rectify example in C4178 #4975

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
Mar 7, 2024

Conversation

Rageking8
Copy link
Contributor

@Rageking8 Rageking8 commented Mar 6, 2024

Rectified some errors in the previous example, namely:

  • The usage of an uninitialized variable i, which is UB
  • The comments on the maximum value being for unsigned int but the type of i is int

The warning is also not emitted with just /W1 and the default settings of a fresh latest VS2022 C++ project. For some reason, the /permissive flag must be set for the warning to be shown. WIth the default of /permissive-, the warning is not emitted even with /Wall and/or /w14178. Not sure if the root cause is some other more granular flag being implicitly set by the permissive flag.

Copy link
Contributor

@Rageking8 : Thanks for your contribution! The author(s) have been notified to review your proposed change.

Copy link
Contributor

Learn Build status updates of commit 22ecb5c:

✅ Validation status: passed

File Status Preview URL Details
docs/error-messages/compiler-warnings/compiler-warning-level-1-c4178.md ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

Copy link
Contributor

PRMerger Results

Issue Description
File Change Percent This PR contains file(s) with more than 30% file change.

@Jak-MS
Copy link
Contributor

Jak-MS commented Mar 6, 2024

@TylerMSFT

  • Can you review this PR?
  • IMPORTANT: When this content is ready to merge, you must add #sign-off in a comment or the approval may get overlooked.

#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

@prmerger-automator prmerger-automator bot added the aq-pr-triaged Tracking label for the PR review team label Mar 6, 2024
@TylerMSFT
Copy link
Collaborator

Looking into why /permissive is required.

Copy link
Collaborator

@TylerMSFT TylerMSFT left a comment

Choose a reason for hiding this comment

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

Thank you. You are correct - the compiler requires /permissive to catch this situation.

@TylerMSFT
Copy link
Collaborator

#sign-off

@Jak-MS Jak-MS merged commit 61d8ea5 into MicrosoftDocs:main Mar 7, 2024
@Rageking8 Rageking8 deleted the rectify-example-in-c4178 branch March 8, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants