CodeWarrior and C++ Standard Library

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

CodeWarrior and C++ Standard Library

1,923件の閲覧回数
spietari
Contributor I

Hi,

 

I've just would like to have a definitive answer to whether I can use Standard  C++ Library classes such as std::string and std::vector. I've got some old classes that I'd need to reuse that rely on those...

 

Is it a question of CW version perhaps too? I'm targeting HCS12.

 

Thanks,

Seppo

ラベル(1)
タグ(1)
0 件の賞賛
3 返答(返信)

611件の閲覧回数
Lundin
Senior Contributor IV
I cannot give you a definite answer, but I know that CW claims to conform to something called "ANSI draft", which is completely irrelevant standard-wise. A standard compiler would claim conformance to the only relevant C++ standard ISO/IEC 14882:1998 or later. I know that there are plenty of standard C++ features lacking even when you select the "full C++" option, for example things as mundane as the bool type and exception handling.

On the other hand, we are talking about a tight, very code-efficient microcontroller for realtime applications. In such applications it doesn't make sense to use STL. Templates and dynamic memory allocation will slaughter all resources on the processor. And for security reasons they will also be banned in all industrial/automotive applications, and in most telecom apps too. For consumer electronics and hobbyist projects it could perhaps make sense to use STL.
0 件の賞賛

611件の閲覧回数
dmctek
Contributor I

As per previous comments, I really can't see anything like STL being supported on this device in fact I'm almost sure that the C environment would also be cut down for example some implementations of printf in the C runtime library can run anywhere between 6-8kb.

 

 

Cheers,

 

Dave,

Scotland.

 

Embedded OS Design Consultant for public/private telecoms switch projects

dmctek.googlepages.com/dload.html

0 件の賞賛

611件の閲覧回数
Lundin
Senior Contributor IV
Actually, CW fully supports ISO C 9899:1990. This is one of the strengths with this compiler. They have support for stdio and other such libs you don't need in a mcu. Through clever implementations of #pragma, you can write code for interrupts, memory allocation etc and still be ISO C compliant. The only time you must use non-standard C is during inline asm.
0 件の賞賛