avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] C++ with PSTR


From: darkschine
Subject: [avr-gcc-list] C++ with PSTR
Date: Sun, 6 Dec 2009 04:20:58 -0800 (PST)

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]