C99: simplify size_t printing with printf #9307
Labels
api-break
This issue/PR breaks the API and must wait for a new major version
component-tls
enhancement
size-s
Estimated task size: small (~2d)
Since Mbed TLS 2.23, we require a C99 platform, with some pragmatic restrictions to support platforms that are mostly but not fully compliant to C99. In particular, we do not require
printf
and friends (snprintf
,vsnprintf
,fprintf
) to support C99 format specifiers.In Mbed TLS 4.0, consider requiring
printf
and friends to support thez
modifier to printsize_t
values with%zu
. This only affects the TLS debugging code (gated byMBEDTLS_DEBUG_C
). That code could be simplified and it would be easier to ensure that we use the right modifiers.We would lose support for older C libraries that don't provide the
z
modifier. Currently, integrators can defineMBEDTLS_PRINTF_SIZET
to e.g.u
orlu
if their platform does not support%zu
. If we remove this possibility, integrators on a platform that does not support%zu
would need to provide a wholeprintf
alternative by definingmbedtls_printf
and friends.Mailing list discussion: https://lists.trustedfirmware.org/archives/list/mbed-tls@lists.trustedfirmware.org/thread/RAV67RL6GF5CX6CFDH5LZAR7RPAY2AEK/
The text was updated successfully, but these errors were encountered: