From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 630 invoked by alias); 27 Sep 2003 12:37:43 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 622 invoked from network); 27 Sep 2003 12:37:43 -0000 Received: from unknown (HELO smtp102.mail.sc5.yahoo.com) (216.136.174.140) by sources.redhat.com with SMTP; 27 Sep 2003 12:37:43 -0000 Received: from rj255064.user.veloxzone.com.br (HELO ?192.168.1.3?) (ramos?fabiano@200.165.255.64 with plain) by smtp.mail.vip.sc5.yahoo.com with SMTP; 27 Sep 2003 12:37:41 -0000 Subject: Re: getting variables in order From: Fabiano Ramos To: gcc-help@gcc.gnu.org In-Reply-To: <3F752ABB.1070201@svn.net> References: <3F752ABB.1070201@svn.net> Content-Type: text/plain Organization: Message-Id: <1064666259.3469.6.camel@xp2200> Mime-Version: 1.0 Date: Sat, 27 Sep 2003 12:37:00 -0000 Content-Transfer-Encoding: 7bit X-SW-Source: 2003-09/txt/msg00301.txt.bz2 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