Skip to content

docs(cpp): clarify Encode separator and padding - #769

Open
vinsymoyya wants to merge 1 commit into
google:mainfrom
vinsymoyya:docs/cpp-encode-format-contract
Open

vinsymoyya wants to merge 1 commit into
google:mainfrom
vinsymoyya:docs/cpp-encode-format-contract

Conversation

@vinsymoyya

Copy link
Copy Markdown

The C++ Encode comment says its separator is optional, which conflicts with the specification and the returned full codes. It also leaves the string length ambiguous when fewer than eight significant digits are requested: a two-digit code such as 8F000000+ has nine characters, rather than three.

Document the required + separator after eight characters, zero padding, and the existing normalization of requested significant-digit counts. This changes only the public API comment.

Validation: a native C++ contract harness checked all ten valid lengths (2, 4, 6, 8, 10 through 15), padding, separator position, and the distinct Shorten result. It also checked requested lengths 0, 1, 3, 5, 7, 9, and 16 against their normalized lengths. The existing C++ suite passed 1,074 tests under MSVC (excluding the benchmark); clang-format --dry-run --Werror cpp/openlocationcode.h and git diff --check passed. The Bazel/multilanguage matrix was not run locally.

Fixes #443.

This branch has not been deployed

No deployments
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.

CPP implementation: does not reference a required separator character

1 participant