Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: need variables to be stored in EEPROM

2005-04-25 by arhodes19044

Great!  I do not remember the "offsetof()" function.  I will look it 
up right now.  THANKS

-Tony

--- In AVR-Chat@yahoogroups.com, Robert Adsett <subscriptions@a...> 
wrote:
> At 07:16 PM 4/25/05 +0000, arhodes19044 wrote:
> >It has been a long time since I worked with structures.  Is there 
a
> >way to get the offset of the element within the structure?
> >Something like "&structure.element".  This way, I can start with 
the
> >location of the structure in SRAM or in EEPROM and then access the
> >individual element by base + offset.  Will sizeof() work with
> >structure elements?
> 
> Look for the standard macro offsetof().  And yes sizeof works with 
> structure elements, although depending on the compiler and micro 
adding up 
> the sizes of the previous elements will not necessarily give the 
same 
> answer as offsetof (I expect it would on an AVR).
> 
> Robert
> 
> " 'Freedom' has no meaning of itself.  There are always 
restrictions,   be 
> they legal, genetic, or physical.  If you don't believe me, try to 
chew a 
> radio signal. "  -- Kelvin Throop, III
> http://www.aeolusdevelopment.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.