Watcom container class question

Folks,
I’m trying to use the Watcom container classes (WCPtrVector) and
catch exceptions thrown by them. I can’t figure out what to catch.
I’ve tried catching WCExcept, WCExcept::wcstate and int. I can generate
an out_of_memory exception easily enough, but the program just
terminates with an unhandled exception error. Are there examples of the
intended usage anywhere?

I’m using QNX 4.25 and Watcom C/C++ 10.6

Ted Hildum

Edward A. Hildum <ehildum@mail.arc.nasa.gov> wrote:

Folks,
I’m trying to use the Watcom container classes (WCPtrVector) and
catch exceptions thrown by them. I can’t figure out what to catch.
I’ve tried catching WCExcept, WCExcept::wcstate and int. I can generate
an out_of_memory exception easily enough, but the program just
terminates with an unhandled exception error. Are there examples of the
intended usage anywhere?

wpp386 has exception handling disabled by default – you need to enable
it by passing the -xs option to wpp386. Normally you would do this by
adding “-WC,-xs” to you cc options.

-David

QNX Training Services
dagibbs@qnx.com

Thanks for the reply, David.

Actually, I have the -xs option turned on. I found the answer is in the
wcexcept.h header
file. The containers throw exceptions of type WCExcept::failure. This isn’t
mentioned in the
online docs. Maybe it could be added :slight_smile:.

Ted Hildum

David Gibbs wrote:

Edward A. Hildum <> ehildum@mail.arc.nasa.gov> > wrote:
Folks,
I’m trying to use the Watcom container classes (WCPtrVector) and
catch exceptions thrown by them. I can’t figure out what to catch.
I’ve tried catching WCExcept, WCExcept::wcstate and int. I can generate
an out_of_memory exception easily enough, but the program just
terminates with an unhandled exception error. Are there examples of the
intended usage anywhere?

wpp386 has exception handling disabled by default – you need to enable
it by passing the -xs option to wpp386. Normally you would do this by
adding “-WC,-xs” to you cc options.

-David

QNX Training Services
dagibbs@qnx.com