<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 17, 2015 at 7:30 PM, Linus Torvalds <span dir="ltr"><<a href="mailto:torvalds@linux-foundation.org" target="_blank">torvalds@linux-foundation.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, Sep 17, 2015 at 3:18 PM, Tomaz Canabrava <<a href="mailto:tcanabrava@kde.org">tcanabrava@kde.org</a>> wrote:<br>
><br>
> move all members on the class to public access, then create static functions<br>
> on the .cpp file like this:<br>
><br>
> static void helper_function1(MyClass *self, var1, var2... ) {<br>
> ...<br>
> }<br>
<br>
</span>Yes, yes, I know this very well. And then you have that mixture of<br>
explicit object pointers and implicit method member uses, and it just<br>
confuses everybody because the "same" code ends up looking very<br>
different indeed. It's detestable, and it makes it impossible to move<br>
the *same* code out to a helper function: you basically have to edit<br>
the end result so that it doesn't look at all the same as what it<br>
would do inside the function.<br>
<br>
.. and there's no reason for it. C++ should just have allowed private<br>
static (or inlined) member functions that have to be resolved at<br>
compile-time within that function and don't need declaration because<br>
they don't have any external visibility and no possible virtual<br>
entries.<br>
<br>
You'd almost be better off just using "this->" everywhere, just to<br>
have that consistent syntax.<br>
<br>
And I really _detest_ changing header files for local re-organization.<br>
It is just another reason C++ projects take forever to build - because<br>
even local cleanups end up forcing a full rebuild just because you<br>
ended up changing the member functions.<br>
<br>
The last time this came up I think Thiago said that there's support<br>
for it in the upcoming C++ standard. So _eventually_ you can just make<br>
inlined helpers, I hope.<br></blockquote><div><br></div><div>Well, there's hope.<br></div><div>My code today is a fine mix between C and C++ code thanks to Subsurface and Soletta.<br></div><div>One thing that I'm actually spending a bit of time here in my local repo is to figure out all the<br></div><div>headers that can be moved out of another headers so the compile time would be affected.<br><br></div><div>Already managed to get quite a few out, I hope to decrease compile times sensibly.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
             Linus<br>
</font></span></blockquote></div><br></div></div>