DSPRelated.com
Forums

Embedded C++ and C++ Exceptions

Started by William C Bonner September 27, 2007
I'm using C++ on a TMS320C6713. I'm using CCS 3.1.23 with code
generation tools v5.1.0.

I have been using the compiler option related to Embedded C++ (-pe) but
I wanted to use exceptions in my code for some error handling, so I
stopped using that option.

I started by adding a try block around the code in question, and a catch
block below that. I got error messages:

"myfile.cpp", line 10: error: support for exception handling is disabled
"myfile.cpp", line 25: error: handler requires an exception declaration

I then went reading more of the help, and am not sure whether this
environment supports exception handling with any option settings. Can
anyone tell me what I might be able to do to enable exceptions? Is
there a newer version of the compiler system that may support it?

Wim.
William,

--- William C Bonner wrote:

> I'm using C++ on a TMS320C6713. I'm using CCS 3.1.23
> with code
> generation tools v5.1.0.
>
> I have been using the compiler option related to
> Embedded C++ (-pe) but
> I wanted to use exceptions in my code for some error
> handling, so I
> stopped using that option.
>
> I started by adding a try block around the code in
> question, and a catch
> block below that. I got error messages:
>
> "myfile.cpp", line 10: error: support for exception
> handling is disabled
> "myfile.cpp", line 25: error: handler requires an
> exception declaration
>
> I then went reading more of the help, and am not
> sure whether this
> environment supports exception handling with any
> option settings. Can
> anyone tell me what I might be able to do to enable
> exceptions? Is
> there a newer version of the compiler system that
> may support it?

I haven't used exceptions, but the following info was
found in my docs/pdf directories. Note- I find the
pdf manuals more useful than the help files. You
*should* be able to find the latest at ti.com - search
for 'spru187'

from my CCS 3.3 installation...
spru187n.pdf
TMS320C6000 Optimizing Compiler
v 6.0 Beta
The compiler supports all the C++ exception handling
features as defined by the ISO 14882 C++
Standard. More details are discussed in The C++
Programming Language, Third Edition by Bjarne
Stroustrup.
The compiler --exceptions option enables exception
handling. The compilers default is no exception
handling support.
For exceptions to work correctly, all C++ files in the
application must be compiled with the --exceptions
option, regardless of whether exceptions occur in a
particular file. Mixing exception-enabled object files
and libraries with object files and libraries that do
not have exceptions enabled can lead to undefined
behavior. Also, when using --exceptions, you need to
link with run-time-support libraries whose name
contains _eh. These libraries contain functions that
implement exception handling.
Using --exceptions causes increases in code size and
execution time, even if no exceptions are thrown.

from my CCS 3.1 installation...
spru187l.pdf -
Exception handling is not supported. The exception and
stdexcept include
files, which are for C++ only, are empty.
>
> Wim.
>