From 21804aecdbba25d2322d1ab8e44f130766fb062f Mon Sep 17 00:00:00 2001 From: "Daniel J. Hofmann" Date: Fri, 8 Jan 2016 23:33:31 +0100 Subject: [PATCH] Prefer `inline` over `static inline` for free standing functions When you mark free standing functions as `static inline` instead of just `inline` they can not get merged across TUs and therefore produce code bloat which is bad for the binaries size, the CPUs instruction cache, and so on. Please also see the discussion at: - https://groups.google.com/forum/#!topic/mozilla.dev.platform/Ulw9HoZbSyQ - http://stackoverflow.com/a/12836392 Note that non-fully specialized templates (i.e. with a kind of at least `Template :: * -> *`) are `inline` by default. --- include/util/string_util.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/util/string_util.hpp b/include/util/string_util.hpp index 1a54c9475..41c5f091f 100644 --- a/include/util/string_util.hpp +++ b/include/util/string_util.hpp @@ -15,7 +15,7 @@ namespace util // precision: position after decimal point // length: maximum number of digits including comma and decimals // work with negative values to prevent overflowing when taking -value -template static inline char *printInt(char *buffer, int value) +template char *printInt(char *buffer, int value) { static_assert(length > 0, "length must be positive"); static_assert(precision > 0, "precision must be positive");