[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Assembly language help for a noob
From: |
Francesco Sacchi |
Subject: |
Re: [avr-gcc-list] Assembly language help for a noob |
Date: |
Fri, 14 Sep 2007 09:28:41 +0200 |
User-agent: |
Thunderbird 2.0.0.4 (X11/20070615) |
Gre7g Luterman ha scritto:
I'm sure there must be a more efficient way than
defining AoffP, AoffQ, and AoffR, but I'm just not
knowledgeable enough yet! Can anyone clue me in on
the good tricks?
This is the offsetof macro we use in our projects:
#define offsetof(s,m) (size_t)&(((s *)0)->m)
In your case, you can use it like this in your code to get member offsets:
offsetof(A, P)
offsetof(A, Q)
offsetof(A, R)
Is a macro, so it get expanded by preprocessor.
--
_|/ Francesco Sacchi - Develer S.r.l., R&D dept.
|\ http://www.develer.com/