Use of assert(false)
in outcome::detail::make_ub
may cause significant code-bloat
#294
Labels
assert(false)
in outcome::detail::make_ub
may cause significant code-bloat
#294
It appears that the
assert
I got shipped with mygcc-arm-none-eabi
(embedded 32bit Arm) tries to be helpful, and generates a call like__assert_func(__FILE__, __LINE__, __PRETTY_FUNCTION__)
. Withintemplate <class T> void make_ub(T &)
,__PRETTY_FUNCTION__
expands to a string that contains the fully demangled name ofT
, which may potentially be very long. In my specific case, that amounted to 150 kB of strings for a firmware that was otherwise ~100 kB big. Trying to fit a flash size of 256 kB, that is a challenge. While these strings obviously go away by definingNDEBUG
, for a vocabulary type likeoutcome
, it may be advisable to offer the user a method to avoid that bloat in builds withoutNDEBUG
.Maybe there could be a way to configure that specific use of
assert
, either to a custom implementation (without__PRETTY_FUNCTION__
) or potentially disable it completely?The text was updated successfully, but these errors were encountered: