Subroutine could benefit from exception specification

Subroutines that can only throw one kind of exception can benefit from an exception specification.

An exception specification enumerates the exceptions that could be thrown by a subroutine. This information is useful to the compiler and may allow it to generate more efficient code. This diagnostic indicates that the indicated subroutine only throws one kind of exception. Therefore, it should be possible to create an exception specification naming only that exception.

Even if exception specifications are not enforced (they are not enforced on Windows* OS), they still provide a useful documentation function. Users reading about the subroutine might be interested to know that it can throw a specific kind of exception since it reminds them to provide a corresponding catch block.

ID

Observation

Description

1

Definition

This shows where the subroutine was defined

Copyright © 2010, Intel Corporation. All rights reserved.