FastLED 3.10.10
Loading...
Searching...
No Matches

◆ makeName()

fl::string fl::Channel::makeName ( i32 id,
const fl::optional< fl::string > & configName = fl::optional<fl::string>() )
staticprivate

Definition at line 273 of file channel.cpp.hpp.

273 {
274 if (configName.has_value()) {
275 return configName.value();
276 }
277 // Auto-naming `"Channel_<id>"` only matters for diagnostics — in release
278 // builds (NDEBUG → FASTLED_LOG_VERBOSITY=0 per Stage 1) every FL_WARN /
279 // FL_ERROR site that reads mName collapses to `do { } while(0)`, so the
280 // string and the supporting `fl::to_string` + `operator+` chain go
281 // unused. Empty in release saves the `fl::to_string<i64>` instantiation
282 // plus the heap allocation per Channel ctor. See #2942 / #2886.
283#if FASTLED_LOG_RUNTIME_ENABLED
284 return "Channel_" + fl::to_string(static_cast<i64>(id));
285#else
286 (void)id;
287 return {};
288#endif
289}
T & value() FL_NO_EXCEPT
Definition optional.h:112
bool has_value() const FL_NO_EXCEPT
Definition optional.h:42
fl::i64 i64
Definition s16x16x4.h:222
string to_string(T value) FL_NO_EXCEPT
Definition string.h:459

References fl::FL_NO_EXCEPT, and fl::to_string().

Referenced by Channel(), Channel(), create(), and operator=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: