-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Allow disabling floating point support #1590
Conversation
Add FMT_USE_FLOAT, FMT_USE_DOUBLE and FMT_USE_LONG_DOUBLE to allow a user of the library to configure the float types they want to allow. This is specially useful in embedded environements where code size is important.
Thanks for the PR. Have you verified that this indeed results in smaller binary code? Could you provide any specific numbers? |
Yeah on our current image, stripped and compiled with -0s using the GCC 4.8 bare metal toolchain (available at https://launchpad.net/gcc-arm-embedded/+download) we save the following: FMT_USE_FLOAT=1 FMT_USE_DOUBLE=1 FMT_USE_LONG_DOUBLE=0 FMT_USE_FLOAT=1 FMT_USE_DOUBLE=0 FMT_USE_LONG_DOUBLE=0 FMT_USE_FLOAT=0 FMT_USE_DOUBLE=0 FMT_USE_LONG_DOUBLE=0 |
Do you need partial float support? If not I'd suggest having just one control to enable/disable all floating-point formatting instead of doing it type-by-type. |
Yes, on some platforms we need single precision float formatting, but not double or long double. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general but let's make it a bit less intrusive.
Add FMT_USE_FLOAT, FMT_USE_DOUBLE and FMT_USE_LONG_DOUBLE to allow a
user of the library to configure the float types they want to allow.
This is specially useful in embedded environements where code size is
important.
I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.