Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is mp-units targeting freestanding implementations #556

Open
kwikius opened this issue Feb 19, 2024 · 6 comments
Open

Is mp-units targeting freestanding implementations #556

kwikius opened this issue Feb 19, 2024 · 6 comments

Comments

@kwikius
Copy link
Contributor

kwikius commented Feb 19, 2024

As title . I work mainly on embedded systems, which are typically freestanding . Is mp-units going to require a hosted implementation?

@mpusz
Copy link
Owner

mpusz commented Feb 19, 2024

Sure, freestanding is our target as stated here https://wg21.link/p3045#low-standardization-cost and as I explicitly said several times before (#406, #7).

@kwikius
Copy link
Contributor Author

kwikius commented Feb 20, 2024

Sure, freestanding is our target as stated here https://wg21.link/p3045#low-standardization-cost and as I explicitly said several times before (#406, #7).

OK. Apologies. I have not followed mp-units for a while. That is reassuring, but slightly vague. Ideally I would hope for the full functionality but without major IO overhead , though in practise some diagnostic output in a simple format is always going to be required.

@mpusz
Copy link
Owner

mpusz commented Feb 20, 2024

Initially, we tried to isolate IO as much as possible (separate CMake targets, separate C++ modules, etc.), but it didn't scale. I consulted the best freestanding experts in the ISO Committee on how to proceed, and they said to do the same as a C++ standard library does. If needed, we will provide preprocessor logic to limit functionality for freestanding if such is requested by the users.

in practise some diagnostic output in a simple format is always going to be required.

Sure, this is why we expose the following functions that should help build a custom mechanism without the need to include streams or formatting facilities:

template<typename CharT = char, std::output_iterator<CharT> Out, Unit U>
constexpr Out unit_symbol_to(Out out, U u, unit_symbol_formatting fmt = unit_symbol_formatting{})

template<unit_symbol_formatting fmt = unit_symbol_formatting{}, typename CharT = char, Unit U>
[[nodiscard]] consteval auto unit_symbol(U)

@kwikius
Copy link
Contributor Author

kwikius commented Feb 20, 2024

I will try to get back to testing mp-units. In embedded environment absolute limit is the amount of rom available on the microcontroller. The smaller the footprint of the library, the bigger the range of microcontroller a library will run on. nyway don't underestimate the microcontroller side. It is a large user base and could find mp-units very useful, but don't make anything like as much noise as others ;)

@mpusz
Copy link
Owner

mpusz commented Feb 20, 2024

This would be great @kwikius! As of now we don't use any conditional compilation for freestanding. We need to decide if we should introduce custom flags or use those used by the compiler vendors. But we need some for sure and we need some testing on embedded environments as well.

@mpusz
Copy link
Owner

mpusz commented Feb 20, 2024

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

No branches or pull requests

2 participants