FastLED 3.10.8
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 271 of file channel.cpp.hpp.

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

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: