In Arduino, we are asked to avoid the String class at all cost. What about programming the ESP8266 using the Arduino IDE? I'm asking because I noticed in a lot of examples, the HTTP methods, ie httpget results; http server request arguments, they appear to return the results in Strings. Will this eventually cause issues with memory?
Yes possibly and later because you have way more memory in the ESP than in your UNO but not gigabytes of vurtualized memory either
Here is an article that explains why many here think it's not a great class on small memory devices
J-M-L: Here is an article that explains why many don't think it's not a great class on small memory devices
Thanks for the link J-M-L...it should be required reading for everyone who uses this Forum. And, thanks to Majenko for taking the time to provide such a well-written discussion of the String/string issues.
…many don’t think it’s not a great class…
Did you really mean the double negative, because the article is definitely single negative.
I noticed in a lot of examples… they appear to return the results in Strings.
You may also notice that the most recent occurrences of those examples were criticized for using
String. At about the same time, somebody complained that the example quit working after a while. After switching to character arrays, the problem went away. The same thing has happened over on stackoverflow, too.
…thanks to Majenko
+1 Majenko’s article is pleasant reading. I have gathered up several other articles, covering a wide range of environments (not just Arduino), in a post over here.
Ever on guard,
/dev: Did you really mean the double negative, because the article is definitely single negative. :)
:) I did not - thx
I edited the text above for future generations of readers
I also found it very surprising to see the ESP8266 core using String, not only in the examples but libraries too.
/dev: You may also notice that the most recent occurrences of those examples were criticized for using
Do you remember where that discussion occurred? I'd be interested to read it to try to understand the developers' reasoning for using String.
Thanks for the links and replies. That was what I was afraid to hear. I have first hand experience of how using Strings have affected my program, and I have spent weeks in the past converting a huge arduino sketch from String to cstring. I am really surprised as well as to why they are used in so many esp libraries, when this is a commonly known problem for a long time, and esp libraries are relatively new.