Skip to content

Fix documentation of __STDC__ #5431

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

puetzk
Copy link

@puetzk puetzk commented Jun 17, 2025

getting __STDC__=1 requires setting /Za or /Zc:__STDC__. It doesn't seem to matter whether/what /std is set to.

As best I can tell (experimenting locally with Visual Studio 2022 17.14, and on compiler explorer back to 17.2), the changes made in c139817 do not seem to be accurate. setting /std:c11 or /std:c17 do not result in having #define __STDC__ 1. See https://godbolt.org/z/65YvxPYM3

This agrees with the documentation of https://learn.microsoft.com/en-us/cpp/build/reference/zc-stdc?view=msvc-170, which says

This option is a source breaking change. Due to the behavior of the UCRT, which doesn't expose POSIX functions when STDC is 1, it isn't possible to define this macro for C by default without introducing breaking changes to the stable language versions.

So I suspect having /std:c11 set __STDC__=1 may have originally been the original intent (and maybe it was true in a preview version?) but it doesn't seem to behave that way in the 17.2 or 17.14 release...

getting `__STDC__=1` requires setting `/Za` or `/Zc:__STDC__`.
It doesn't seem to matter whether/what `/std` is set to.
Copy link
Contributor

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

Copy link
Contributor

Learn Build status updates of commit ad233f6:

✅ Validation status: passed

File Status Preview URL Details
docs/preprocessor/predefined-macros.md ✅Succeeded

For more details, please refer to the build report.

Copy link
Contributor

@Rageking8 Rageking8 left a comment

Choose a reason for hiding this comment

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

@v-dirichards
Copy link
Contributor

@TylerMSFT

Can you review the proposed changes?

Important: When the changes are ready for publication, adding a #sign-off comment is the best way to signal that the PR is ready for the review team to merge.

#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 Jun 18, 2025
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.

This is correct. Thank you.

@TylerMSFT
Copy link
Collaborator

#sign-off

update date since content fixed
Copy link
Contributor

Learn Build status updates of commit b51bd8f:

✅ Validation status: passed

File Status Preview URL Details
docs/preprocessor/predefined-macros.md ✅Succeeded

For more details, please refer to the build report.

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.

4 participants