Problem with GCC 4.5.0 and canadian cross compilation

Peter Dufault dufault at hda.com
Wed Apr 14 10:10:05 UTC 2010


On Apr 14, 2010, at 5:12 , Ralf Corsepius wrote:

> Oh well, ... the better question would be: Is C++ the right language for such targets?

Yes.  Without exception(s). (and many other C++ things)

You can take advantage of constructors and destructors (to obtain a resource and never have a code path that forgets to release it, among other things), strictly enforced access to structures without indirecting all access through opaque pointers, convenient and clear inheritance, etc.  When using C++ for such housekeeping, and when accessing RTEMS and the usual C libraries and not C++ libraries, I haven't found that I need to build a tool chain with "-fno-exceptions".  Do we ever turn on "-fexceptions" when building RTEMS / C tool chains if the language includes C++? If I was a "real" C++ coder this wouldn't be an option since I'd want and use many libraries.

At some clients I've seen frightening C++ code that was never going to work.  You must know what code you're generating, and it will be tough if you have a lot of workers with varying abilities, but I use C++ for all my own code.

One complaint I have about some of the RTEMS headers is that they don't play well with C++:

- C99 designated initializers that are syntax errors in C++;
- Lack of bracketing C externals with 'extern "C" {'

show up in them.  The first is difficult to work around.

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering




More information about the users mailing list