Go Down

Topic: SRAM and storing strings (Read 4 times) previous topic - next topic

PaulS

Quote
The String constructors do not support this data type, which is very unfortunate. Sure, I can go to that class and start making it work but it should be working out of the box;

Why? The String class is for dynamic string creation. The progmem stuff is for static data. I think you're whining too much.

BigMan73


Quote
The String constructors do not support this data type, which is very unfortunate. Sure, I can go to that class and start making it work but it should be working out of the box;

Why? The String class is for dynamic string creation. The progmem stuff is for static data. I think you're whining too much.


So you're saying I cannot concatenate or use Flash strings using String class .. I'll guess I can just do it for my own private and modified version of String class.
I think you're not being very helpful. See post above by Marek080 - that was very helpful and actually resolved my original problem.

Zero warnings are not difficult to achieve - unless you're a mediocre or sloppy programmer

dxw00d

Code: [Select]
String test = F("hello");

Can you explain to me what you think this should do? I'm genuinely curious.

baum

Without the F() syntax, "hello" would be stored in your SRAM. But you don't have a lot of SRAM, so using the F() stores the string in the flash (program) memory, of which you have a lot. Projects that need a lot of strings will benefit from storing strings in flash, as it will free up ram for things like variables. But a flash string cannot be modified.

baum

dxw00d

I know what the F() macro does. I don't understand how you think it should apply when you create a variable that must, by definition, be stored in SRAM.

Go Up