Date: Thu, 6 Jul 2000 12:20:12 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Harald Jeszenszky cc: djgpp AT delorie DOT com Subject: Re: Arbitrary variable order ? In-Reply-To: <396433B4.4370ADC2@oeaw.ac.at> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, 6 Jul 2000, Harald Jeszenszky wrote: > int copy_start; > int variable_1; > ... > int variable_n; > int copy_end; > ... > > The statement > > memcpy(buffer, ©_start, ©_end - ©_start - 1); > > should copy the contents of variable_1 to variable_n to the buffer. This > works fine on the old platform but fails with DJGPP. > > After comparing the map files it turned out that, on the old platform, > the varibles are having the same order in memory as they are declared. That's a heck of an unportable assumption on the part of the program that you are porting. Was that code ported from Fortran or something? > Is there a way to force the compiler to map the variables in memory in > the same order as they are declared? I don't think so. Why do you need that code, anyway? Isn't it possible to rewrite it using simple variables assignments? Apart of having to manually write many "foo = bar" assignments, this should not present any problems.