-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to call String::indexOf with char* for a needle #7705
Comments
I've went ahead and provided a |
https://arduino-esp8266.readthedocs.io/en/latest/PROGMEM.html#functions-to-read-back-from-progmem In the documentation (second paragraph of this section) it says it's UB to call Should I restore the code to have the |
If the documentation says that, it's wrong and we should fix it. Anything using PROGMEM is also safe to use RAM (but not vice-versa, of course!). The ESP8266 isn't like the AVRs where reads from PROGMEM require a special instruction. On the 8266 they just need to be 4-byte aligned and only 32-bits in size. The |
Hey I'm trying to avoid allocating+copying to search for a needle in a haystack. So it would be great if String provided a indexOf method that receives a char*.
Ideally it would provide a method for __FlashStringHelper, but since it uses asm/intrinsics to search I don't know if there is a way to do the search without ignoring that it's from PROGMEM. Is it possible?
Anyway I'm happy with just char*.
The text was updated successfully, but these errors were encountered: