S
Steven Woody
i am using IAR's C++ compiler for M16C target. i found many things with this
product are very strange. i hope someone here can use his experience with the
language and compiler to help me find a clue.
1, Parameter can not be passed into class method.
class Foo {
public:
void paraTest(const int i)
{
if ( i == 500 )
beep();
}
};
so i call the paraTest with foo.paraTest(500) and expect a beep. but, nothing
happened! (my beep function has no problem because it can beep in other place)
2, static initializable data will simply disappear
in one cpp file's outest scope, i have,
static int intArray[5] = {1, 2, 3, 4, 5};
but, once i defined this kind of data, the program would halt. i then checked
the generated map file and found initialization data segment has a size of
zero!
however, if i reference the intArray in some place of the program ( in the main
function), the program will run normally and won't halt. i have already turned
off any option about optimization.
3, the program can only compiled in Far data mode if i use STL
a simple declare of std::string will cause the program crash if i compile the
program in NEAR data mode. but it seems ok if i compiled it in FAR data model.
In my whole experience of programming, i never ever met phenomena like
above. any help will be highly appreciated!
--
steven woody (id: narke)
Virginia Woolf: Someone has to die Leonard, in order that the rest of
us should value our life more.
- The Hours (2002)
product are very strange. i hope someone here can use his experience with the
language and compiler to help me find a clue.
1, Parameter can not be passed into class method.
class Foo {
public:
void paraTest(const int i)
{
if ( i == 500 )
beep();
}
};
so i call the paraTest with foo.paraTest(500) and expect a beep. but, nothing
happened! (my beep function has no problem because it can beep in other place)
2, static initializable data will simply disappear
in one cpp file's outest scope, i have,
static int intArray[5] = {1, 2, 3, 4, 5};
but, once i defined this kind of data, the program would halt. i then checked
the generated map file and found initialization data segment has a size of
zero!
however, if i reference the intArray in some place of the program ( in the main
function), the program will run normally and won't halt. i have already turned
off any option about optimization.
3, the program can only compiled in Far data mode if i use STL
a simple declare of std::string will cause the program crash if i compile the
program in NEAR data mode. but it seems ok if i compiled it in FAR data model.
In my whole experience of programming, i never ever met phenomena like
above. any help will be highly appreciated!
--
steven woody (id: narke)
Virginia Woolf: Someone has to die Leonard, in order that the rest of
us should value our life more.
- The Hours (2002)