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

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

Re: [avr-gcc-list] Space optimisation for PSTR()


From: E. Weddington
Subject: Re: [avr-gcc-list] Space optimisation for PSTR()
Date: Fri, 27 Aug 2004 10:13:22 -0600
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

Bernard Fouche wrote:

Hi there.

It seems that if I use twice the same string in the program thru PSTR(), the
string will be stored twice?

For instance:

fputs_P("blabla",OutStream);

then later in the code:

fputs_P("blabla",OutStream);


That probably should be:
fputs_P(PSTR("blabla", OutStream);
Right?

"blabla" will be stocked twice in the flash memory. (I'm looking at the .lss
file).
I am right?
Yes.

If so will such a space optimisation be done in the near future
Doubtful.

or should I manage my strings myself? (by passing the address of a string if
I re-use it instead of relying on PSTR())
Yes.

It's fairly straightforward to set up a header file that contains all your defined strings with identifiers, then use the identifiers everywhere in your code.

HTH
Eric



reply via email to

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