Skip to content

docs: document MSVC compile-time format checking limitation in str_format.h#2064

Closed
DrishtiTripathi2230 wants to merge 2 commits into
abseil:masterfrom
DrishtiTripathi2230:docs/strformat-msvc-compile-time-check
Closed

docs: document MSVC compile-time format checking limitation in str_format.h#2064
DrishtiTripathi2230 wants to merge 2 commits into
abseil:masterfrom
DrishtiTripathi2230:docs/strformat-msvc-compile-time-check

Conversation

@DrishtiTripathi2230
Copy link
Copy Markdown
Contributor

Fixes #1478

absl::StrFormat compile-time format string checking relies on
attribute((format(...))), a GCC/Clang-specific compiler extension
that MSVC does not support. This adds a note to the file-level
documentation so MSVC users are aware that format string errors will
only be caught at runtime, not at compile time.

Copy link
Copy Markdown
Member

@derekmauro derekmauro left a comment

Choose a reason for hiding this comment

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

The added top-level "Compiler Support Note" is a bit prominent and interrupts the introductory flow of the file. It describes a platform limitation rather than focusing on how to use the library correctly.

A cleaner, less distracting approach is to integrate this platform note directly into the sections that discuss compile-time format checking. This keeps the documentation focused on the feature itself and naturally qualifies it for MSVC users.

How about around line 51: "The FormatSpec<Args...> template is evaluated at compile-time, providing type safety (supported on GCC and Clang; on MSVC, these checks are deferred to runtime)."

And around line 180: "Note: Compile-time format string checking is supported on GCC and Clang. On MSVC, these checks are performed at runtime instead."

@DrishtiTripathi2230
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback! I've updated the PR to integrate the MSVC notes inline — one in the FormatSpec overview section and one just before the FormatSpec template declaration, as suggested.

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.

[Bug]: Compile-time string format checking not working with MSVC

2 participants