arduino – Whats the meaning of F(string) in C++?
This macro is Arduino-specific, its not C++ as such.
It places the string in flash memory, to conserve RAM.
It means the string cannot be modified when the program runs.
One current definition is:
#define F(slit) (reinterpret_cast<const __FlashStringHelper *>(PSTR(slit)))
F() is one of the most powerful functions, which was added with the
1.0 release of the
IDE. I keep mixing the terms
F() really isn’t a
function, it is a
#define macro which lives in
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
It is a macro, which use for storing
flash memory rather than