This topic is covered all over avr forums in bits and pieces so please keep
responses to a minimum. The problem is that when using PSTR("String") in a
cpp file, the compiler generates the warning:

warning: only initialized variables can be placed into program memory area

despite the warning, the code operates as desired, however, each occurrence
of PSTR() generates the warning and therefore makes it difficult to
efficiently analyse the compiler's output

A reported solution to the problem is to redefine PSTR from

# define PSTR(s) (__extension__({static char __c[] PROGMEM = (s);
&__c[0];})) 
to
# define PSTR(s) (__extension__({static prog_char __c[] = (s); &__c[0];})) 

This solution prevents the warning but also causes the program to operate
incorrectly

Does anyone have a proven solution or workaround for this problem? Is there
anything that can be done to at least suppress the warning without
suppressing other warnings?
-- 
View this message in context: 
http://old.nabble.com/C%2B%2B-with-PSTR-tp26664456p26664456.html
Sent from the AVR - gcc mailing list archive at Nabble.com.



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to