다음을 통해 공유


Exception Handling Overhead (Windows CE 5.0)

Send Feedback

The extra overhead associated with the C++ exception handling mechanism can increase the size of executable files and slow program execution time.

The /GX - Enable Exception Handling compiler option enables C++ exception handling and unwind semantics.

If you are not using C++ exception handling in your program and you want to eliminate the associated overhead, use the /GX- compiler option to turn off exception handling and unwind semantics. The default is /GX-.

Because of the nature of exception handling and the extra overhead involved, exceptions should be used only to signal the occurrence of unusual or unanticipated program events.

Exception handlers should not be used to redirect the program's normal flow of control. For example, an exception should not be thrown in cases of potential logic or user input errors, such as the overflow of an array boundary.

In these cases, returning an error code can be simpler and more concise. Judicious use of exception handling constructs makes your program easier to maintain and your code more readable.

See Also

Exception Handling for Embedded Visual C++

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.