[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] strange c++ obiect initialization problems (full code inc

From: Marcin S
Subject: [avr-gcc-list] strange c++ obiect initialization problems (full code included)
Date: Thu, 9 Jun 2011 06:42:25 +0000

Hello there,

from time to time i have a strange problems when initializing class
objects in file range by their respective constructors, i noted that
problem occurs only when that constructors takes pointers to other
global objects, tables or something else.

Whats the problem? in best scenario object pointer are wrongly set and
pointing to some random locations, at worst my program does not start
at all (event with my main() func empty) it just hangs

here is link to my code
its and eclipse project, simple "make" in project directory should
work too. Note that archive contains already compiled program in
"Release" directory, this compilation does not work at all! (worst
case scenario described above).

As I wrote this program incrementaly it stopped working after i added
2 objects inits in layouts.cpp

        CLayPGMString minTag(minTagData,strMin,true,CLayPGMString::XSMALL);
        CLayPGMString maxTag(maxTagData,strMax,true,CLayPGMString::XSMALL);

strMin and strMax params are pointers to strings in PROGMEM, if i
replace it with zeros like

        CLayPGMString minTag(minTagData,0,true,CLayPGMString::XSMALL);
        CLayPGMString maxTag(maxTagData,0,true,CLayPGMString::XSMALL);

program starts again.

Other important thing noted is, when I initialise those objects in
file range with their default, empty constructors and then set needed
pointers at run time (for example right after main() function)
everything works too.
I ran out of ideas what could be wrong, maybe wrong code, I'm open to
any suggestions.

I'm using avr-gcc-4.5.2 on gentoo linux, also checked on stable 4.4
and it behaves exactly the same way.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]