Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Codan warning "Catch uses reference to exception"

Elena,
Why do you want us to avoid catching exceptions by reference? Shouldn't it be the other way around? Catching by reference is recommended by C++ experts, for example Herb Sutter/Andrei Alexandresscu "C++ Coding Standards", Rule 73 "Throw by value, catch by reference". For one thing, this avoids copying and potentially slicing the exception.
 
Andrew

Back to the top