eProsima / Micro-XRCE-DDS-Client

Micro XRCE-DDS Client repository. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
130 stars 82 forks source link

Simplify buffer creation for hard liveness interval value #368

Closed yashi closed 11 months ago

yashi commented 11 months ago

We can simply use snprintf() to generate string representation of an integer value in a 7 bytes bufffer.

pablogs9 commented 11 months ago

Hello @yashi, as far as I remember this was done like this because there are some highly embedded toolchains that have a restricted usage of printf-family, in fact, there are platforms where there are no printf-family at all for code size/performance reasons.

I agree with using libc calls when possible, but this case is kind of special.

Is this critical for your use case? In that case, we can turn the approach into a macro-conditional section, where, if the end user ensures the existence of snprintf by enabling some CMake flag, the library will use your proposal.

If this is not critical for your use case, we prefer to keep it as it is.

yashi commented 11 months ago

OK. Thanks. Closing.