global variables not defined contiguously in memory

Andrew Haley aph@redhat.com
Thu Mar 5 15:11:00 GMT 2009


mikwilmot wrote:
> We are having a problem with defining global variables and having them
> allocated contiguously in memory.  There are two portions of two different
> files. In FILE 1 the variables are defined all over memory, in FILE 2 the
> variables are defined contiguously in memory.  Our application has certain
> reads that requires variables be defined one after another in memory.

Oh dear.  That's really bad.

If you want contiguous allocation, you'll have to put all
your global variables in a struct.

Andrew.



More information about the Gcc-help mailing list