From: Wolfgang Bangerth Date: Fri, 26 May 2017 15:37:58 +0000 (-0600) Subject: Better document why we take a large argument by value. X-Git-Tag: v9.0.0-rc1~1574^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0074abfd18d7ef253af3988e3961ee7f5bbaa0f;p=dealii.git Better document why we take a large argument by value. This addresses an issue found by Coverity. We copy the argument intentionally. --- diff --git a/include/deal.II/base/exceptions.h b/include/deal.II/base/exceptions.h index 5b80e219dd..4ed28c650b 100644 --- a/include/deal.II/base/exceptions.h +++ b/include/deal.II/base/exceptions.h @@ -265,16 +265,22 @@ namespace deal_II_exceptions * This routine does the main work for the exception generation mechanism * used in the Assert macro. * + * The actual exception object (the last argument) is typically an unnamed + * object created in place; because we modify it, we can't take it by + * const reference, and temporaries don't bind to non-const references. + * So take it by value (=copy it) -- the performance implications are + * pretty minimal anyway. + * * @ref ExceptionBase */ - template - void issue_error (ExceptionHandling handling, - const char *file, - int line, - const char *function, - const char *cond, - const char *exc_name, - exc e) + template + void issue_error (ExceptionHandling handling, + const char *file, + int line, + const char *function, + const char *cond, + const char *exc_name, + ExceptionType e) { // Fill the fields of the exception object e.set_fields (file, line, function, cond, exc_name);