gazebosim/gz-common

Helper functions for conversions that are locale independent

Ouverte

#233 ouverte le 26 juil. 2021

 (3 commentaires) (0 réaction) (0 personne assignée)C++ (59 forks)auto 404
enhancementhelp wanted

Métriques du dépôt

Stars
 (28 étoiles)
Métriques de merge PR
 (Merge moyen 9j 6h) (30 PRs mergées en 30 j)

Description

Desired behavior

Different software in the Ignition family uses all kind of C/C++ functions to convert between types that are locale dependent and make functionality to fail under non C locales. Examples are:

Trying to complete the list (split due to limitations in github search) based on https://www.gnu.org/software/libc/manual/html_node/Parsing-of-Numbers.html:

Alternatives considered

There is a native function in C++17 https://en.cppreference.com/w/cpp/utility/to_chars which is not available in all supported platforms at this time. The boost::lexical_cast could be an option but would be ideal not to depend on boost if possible.

Implementation suggestion

I think that the best approach would be to implement helper functions that encapsulate the implementation in this ign-common repository. The implementation can rely on to_chars if C++17 is available or use other workarounds (see https://github.com/ros/urdfdom_headers/pull/42).

A similar work was done for sdformat years ago. Following the locale_fix test can lead to details.

Guide contributeur