By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,434 Members | 1,858 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,434 IT Pros & Developers. It's quick & easy.

Bit Problem I met with IAR's C++ Compiler

P: n/a

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)
Nov 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Steven Woody wrote:
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)


I don't have any experience with this compiler, but it sounds like it
is non-conformant, buggy, or both. Hence, your post is unfortunately
off-topic here since this newsgroup is for standard C++ language
discussions rather than compiler-specific questions, and you'll have to
either talk to your vendor or post in a more relevant newsgroup.

See the FAQ for what is on-topic and for some suggestions on which
other groups you can try:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9 .

Cheers! --M

Nov 22 '05 #2

P: n/a
Steven Woody wrote:
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.

[...]


First off, have you tried contacting their technical support? If yes,
what (if anything) did they say? If not, why not?

V
Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.