Mail Archives: djgpp/1998/12/31/07:42:16
BJC wrote:
> In article <767k28$e46$1 AT latinum DOT dresearch DOT de>, beck AT dresearch DOT de says...
> > No, sorryly this is a bug in you :-)
>
> heh, it figures ;-)
>
> > >i compiled this program with DJGPP 2.01 and PGCC 1.01 and all was
> > well...infact it left 2
> > >bytes space between str2 and str1.
> >
> > It's difficult to say why. Maybe the optimizers in this compilers think,
> > that the strings should be allocated
> > 8 bytes aligned...
>
> hmm...
>
Actually the compiler should optimize to 4 byte boundaries. Remember str1 - its
5 bytes. This will be rounded up to the nearest multiple of 4 (which is 8). Your
str2 happens to be exactly 4 bytes so no optimization is needed.
In the DJGPP faq it is stated that optimizing to 4 byte boundaries is needed to
gain a big speed increase in program execution (it is a 32-bit compiler). If you
really are low on memory you may instruct the compiler explicitly to not
optimize to 4-byte boundaries with the __packed__ attribute. Read all about this
in the docs that came with djgpp.
> > So the problem is your for loop. Note, that in C the typical construct for
> > traversing n elements is
> > for (i = 0; i < n; ++i)
>
> JonnyCarsonMode(tm) ON
> "oh, i did not know that."
> JonnyCarsonMode(tm) OFF
>
> heehee, well like i said i'm still new to programming.
> Thanks for the replys!!
>
> --
> brian james chapman
> email: bchapman(at)feist(dot)com
- Raw text -