From 7a9c5ac0ed0e6f8515d89f85a037a2c168ac3d1e Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Mon, 5 Mar 2012 11:48:34 -0800 Subject: [PATCH] add note about generally passing built in types by value - for most compilers this should be faster --- docs/contributing.markdown | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/contributing.markdown b/docs/contributing.markdown index d733242d6..36b6b8d01 100644 --- a/docs/contributing.markdown +++ b/docs/contributing.markdown @@ -101,6 +101,12 @@ If you see bits of code around that do not follow these please don't hesitate to std::string const& variable_name // no +#### Pass built-in types by value, all others by const& + + void my_function(int double val); // if int, char, double, etc pass by value + + void my_function(std::string const& val); // if std::string or user type, pass by const& + #### Shared pointers should be created with [boost::make_shared](http://www.boost.org/doc/libs/1_47_0/libs/smart_ptr/make_shared.html) where possible #### Function definitions should not be separated from their arguments: