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

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

Re: [avr-gcc-list] typdefing 'cost' .. PROGMEM doesn't work


From: Dave Hansen
Subject: Re: [avr-gcc-list] typdefing 'cost' .. PROGMEM doesn't work
Date: Fri, 01 Aug 2003 09:00:24 -0400

Joerg Wunsch wrote:
As Reza Naima <address@hidden> wrote:

>So, would this imply that I found a bug, or am I still missing
>something?

Yes, you're still missing something.

"const" is /not/ a storage class or something to that avail.  A
variable qualified with const is just a pretty normal SRAM variable
anyway.

You need to look at his original example again. Essentially he had two typedefs and two variable declarations analogous to that below:

  typedef const int PW1 PROGMEM;
  typedef int PW2 PROGMEM;

  PW1 v1;
  const PW2 v2;

with v1 being located in RAM and v2 located in flash. The only difference (that I saw) was the movement of the const qualifier from the typedef to the variable definition.

Modulo the PROGMEM attribute, these variables should be identical: it shouldn't matter where the const appears. I'm not sure how PROGMEM works with typedefs.

FWIW, I avoid putting storage qualifiers (and PROGMEM attributes) on typedefs. They only seem to add confusion. I would expect both of the following variables to reside in flash:

  int const PROGMEM v3;
  int PROGMEM v4;

Regards,
  -=Dave

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



reply via email to

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