This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: getting variables in order
- From: Fabiano Ramos <fabramos at bol dot com dot br>
- To: gcc-help at gcc dot gnu dot org
- Date: 27 Sep 2003 09:37:39 -0300
- Subject: Re: getting variables in order
- Organization:
- References: <3F752ABB.1070201@svn.net>
Used an array instead. I do not know what is your machine, so you should
use sizeof o ensure portability, but I'll assume 1 byte chars and 4 byte
integers:
char variables[17];
char *a = &variables[0];
char *b = &variables[1];
int *c = &variables[2];
char *d = &variables[6];
char *e = &variables[7];
int *f = &variables[12];
char *g = &variables[16];
Fabiano
On Sat, 2003-09-27 at 03:14, Mike Johnson wrote:
> I'd like to define a list of variables as so:
>
> char a;
> char b;
> int c;
> char d;
> char e[5];
> int f;
> char g;
>
> and have them packed and in order in the map file.
>
> when I do this they are defined in some random order in the map
> file.
>
> This is so I can access them as a pointer offset from a to allow
> a user to query the state of the vars.
>
> I'm using the AVR version of GCC.
>
> Thanx for any ideas.
>
> Mike Johnson
>
>
--
Fabiano Ramos <fabramos@bol.com.br>