Closed dhickin closed 9 years ago
Review: Approve.
out of function body so not implicitly inlined. ... Moving outside class to avoid code bloat.
Afaik placement of the definition has no effect on whether a method is inlined. So this change is technically a no-op.
Afaik placement of the definition has no effect on whether a method is inlined.
It does, see https://isocpp.org/wiki/faq/inline-functions#inline-member-fns-more
Fair enough. In this case, I think we do want these methods to be in-linable in the non-error case. Since this is a non-template class, and creating the error messages doesn't involve the template parameter, the obvious thing to do is create a private method throwBadFieldType() or similar to handle the error case.
I wanted to avoid a large function being inlined. I thought this would be an uncontroversial change. I think in practice the compiler is unlikely to actually inline this function though. It hadn't when I looked through objdumps (before the change).
Yes I could add a private function as you suggest or wait until we address an exception hierarchy for these functions, which I was planning to look at next.
So options are:
If you're going to look at adding an exception hierarchy then this pull request will eventually become moot (since the original inline code will get smaller), so I suggest we put this request on hold for now, with the plan that eventually it won't be needed at all.
Move definitions of 2 getSubFieldT overloads:
out of function body so not implicitly inlined.
Implementation now uses stringstream. Moving outside class to avoid code bloat.