Mail Archives: djgpp/2000/07/06/05:21:08
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.
- Raw text -