joboccara / NamedType

Implementation of strong types in C++
MIT License
772 stars 85 forks source link

<iostream> still included in embedded systems #86

Open pirgia opened 4 months ago

pirgia commented 4 months ago

I know the issue has already been reported in issue #57 and the following code:

#if defined(__STDC_HOSTED__)
#    define FLUENT_HOSTED 1
#else
#    define FLUENT_HOSTED 0
#endif

was added to disable the inclusion of \<iostream> for freestanding compilers. Unfortunately, for the STM32 microcontrollers at least, __STDC_HOSTED is defined and is equal to 1, so \ is still included. Setting the -ffreestanding flag is of little use as this has many more undesired collateral effects beyond setting __STDC_HOSTED to 0. The footprint of \ is around 150 kB, which is an enormous amount in my embedded world.

Would it be possible to add a user defined macro that (in conjunction with the __STDC_HOSTED__ macro) enables or disables the inclusion of the \ library?

Thanks for your attention.