This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: global variables in C++ in .data


On Aug  9, 2000, "Michel van Elk" <michel@formula.nl> wrote:

> When I put global variables in a C++ file and compile em with gcc they
> are put in the .data section. In my case this means ROM

This is wrong.  `.rodata' should be ROM, but `.data' is supposed to be
RAM.

> Does anyone know how to get these globals in the .bss section?

Only uninitialized variables go in `.bss'.

> If I rename the file to .C the variable is put in the .bss section,
> just as I would expect.

The semantics of initialization in C and C++ are different.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]