[En-Nut-Discussion] Putting strings etc transparent into PROGMEM

Harald Kipp harald.kipp at egnite.de
Fri Oct 23 11:54:32 CEST 2009


Hi Uwe,

Uwe Bonnes wrote:

> +#ifdef PROGMEM
> +static CONST char os_version_string[] PROGMEM
> +#else
> +static CONST char os_version_string[]
> +#endif
> + = "4.9.7.0";

The #ifs are not required, because non-Harvard architectures provide a
PROGMEM dummy.


> Would this be transparent for a usage like
> ./nut/pro/httpd.c:    fprintf_P(stream, fmt_P, HTTP_MAJOR_VERSION, HTTP_MINOR_VERSION, status, title, NutVersionString());

It would be incompatible, because %P is required instead of %s. This
would break a large number of applications, just to save 8 bytes of RAM.

Harald




More information about the En-Nut-Discussion mailing list