Skip to content

Remove str and xstr macros - #644

Merged
focalintent merged 1 commit into
FastLED:masterfrom
ChristofKaufmann:RemoveStr
Aug 31, 2018
Merged

focalintent merged 1 commit into
FastLED:masterfrom
ChristofKaufmann:RemoveStr

Conversation

@ChristofKaufmann

Copy link
Copy Markdown
Contributor

str macro conflicts with any function or method that has the same name ignoring namespaces and class names. Most noticeably it conflicts with std::basic_stringstream::str(). Using the standard library is possible on platforms like ESP32.

Secondly, there is no usage of the str macro in the library. A grep -nr 'str(' . gives:

./FastLED.h:7:#define xstr(s) str(s)
./FastLED.h:8:#define str(s) #s
./platforms/avr/clockless_trinket.h:271:// #define xstr(a) str(a)
./platforms/avr/clockless_trinket.h:272:// #define str(a) #a
./platforms/avr/clockless_trinket.h:273:// #define ADJDITHER2(D,E) asm __volatile__("subi %[" #D "], " xstr(DUSE) "\n\tand %[" #D "], %[" #E "]\n\t" ASM_VARS);

So there is a second, commented implementation for the avr platform, which is left untouched by this commit. For avr the standard library cannot be used, so on avr it would not conflict immediately, but I would still consider str as a too common name.

`str` macro conflicts with any function or method that has the same
name ignoring namespaces and class names. Most noticeably it conflicts
with `std::basic_stringstream::str()`. Also there is no usage of the
`str` macro in the library.
@focalintent
focalintent merged commit 8b3eda8 into FastLED:master Aug 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants