Story: Replace the deprecated sscanf calls
Table of Contents
This page documents a story in Sprint 28. It captures the goal, current status, acceptance criteria, and the tasks that compose it.
1. Goal
No translation unit calls a C runtime function that MSVC's STL deprecates, so the Windows clang build compiles with -Werror.
2. Status
| Field | Value |
|---|---|
| State | DONE |
| Parent sprint | Sprint 28 |
| Now | Nothing. |
| Waiting on | Nothing. |
| Next | None. |
| Last touched | 2026-10-16 |
3. Acceptance
- run_document_generator.cpp parses the run date through datetime::from_iso8601_date.
- process_executable_tests.cpp reads the build timestamp without std::sscanf.
- The reporting core and platform tests still pass.
4. Tasks
| Task | State | Start | End | Description |
|---|---|---|---|---|
| Scaffold story: Replace the deprecated sscanf calls | DONE | 2026-10-16 | 2026-10-16 | Story scaffolding rides this task: documents, sprint wiring, and the scaffold PR. Close it before merging that PR. |
| Replace both sscanf call sites | DONE | 2026-10-16 | 2026-10-16 | Initial task for: Replace the deprecated sscanf calls |
5. Decisions
- This is the sanction the memory already states.
Use ores.platform for cross-platform functionality
requires a platform primitive in place of a native one wherever ores.platform
has one, because Windows Clang compiles with
-Werror -Wdeprecated-declarationsand MSVC's STL deprecates the native call. Both sites here are that situation withstd::sscanfrather thanstd::getenv, and both are answered by the platform primitive rather than a suppression. - Use the platform's ISO 8601 date primitive rather than suppressing the
warning.
datetime::from_iso8601_dateaccepts the extended form and the basic form, validates the calendar date, and throwsstd::invalid_argumentotherwise.previous_weekdayhand-rolled exactly that withstd::sscanfand then repeated theok()check, so the change removes the deprecated call and a duplicate parser at once. It is also the primitive the estate already uses for ISO dates, at twelve call sites. - Not
time_utils::parse_date, which is the wider reader. That parser exists for ORE's market-data text and deliberately accepts30.09.2025,30-09-2025and30.09.25as well as both ISO forms; its own tests pin those. The run date is required to be ISO 8601 and is refused in those words, so the wider reader would silently accept shapes the check means to reject. - Do not add
_CRT_SECURE_NO_WARNINGSoutside the platform wrapper. The repository already defines it inreal_environment_provider.cpp, whose whole job is to wrapgetenv, and that is the pattern thegetenvfix established. A reporting service and a test are not that, so both call sites lose the call instead of the warning. - The timestamp test uses the platform's format parser.
datetime::from_utc_formatis the primitive for text that is not ISO 8601, such as a log line. It throws unless the whole string matches the format given, so the case proves the format by parsing it rather than by slicing fixed widths.
6. Out of scope
- The
getenvcalls. Those go through the platform provider already, which is the sanctioned wrapper and carries the define. - Any other deprecated C runtime call. A sweep over
projects/for the functions MSVC's STL deprecates found no others.