public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* problem with initialization of global variable & objects
@ 2002-08-29  1:59 Pascal Degryze
  0 siblings, 0 replies; only message in thread
From: Pascal Degryze @ 2002-08-29  1:59 UTC (permalink / raw)
  To: 'gcc-help@gcc.gnu.org'

Hi,
I am a new user of gcc-tools.
I've bought the GNU X-tools from Microcross for ARM-9 core.
It contains gcc version 2.95.2 / ld version 2.9.5.

I've encountered 2 problems:
1) initialization of global variables at runtime doesn work, so for this
example:

  unsigned long LongVar = 123; // initialization doesn't happen

  main()
  {
    LongVar ++;	/* LongVar will not be 124, but dummy */
  }

LongVar will have a dummy value. The initialisation must happen in main() to
work properly:

  main()
  {
    unsigned long LongVar = 123;
    LongVar ++;	/* LongVar will not be 124, but dummy */
  }


2) For a global defined object, the constructor is not called at runtime. 
Creating an object must happen in a function.

What is the reason for all this initialisation problems? 
Thanks.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-08-29  8:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-29  1:59 problem with initialization of global variable & objects Pascal Degryze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).