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.
This commit is contained in:
parent
6991a38703
commit
21804aecdb
@ -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 <int length, int precision> static inline char *printInt(char *buffer, int value)
|
||||
template <int length, int precision> char *printInt(char *buffer, int value)
|
||||
{
|
||||
static_assert(length > 0, "length must be positive");
|
||||
static_assert(precision > 0, "precision must be positive");
|
||||
|
Loading…
Reference in New Issue
Block a user