-
Notifications
You must be signed in to change notification settings - Fork 886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inline
keyword unnecessary
#153
Comments
It isn't necessary.
Point 2 above is something that we may want to mention. So, implicit inlining was a good issue to bring up. |
I kindly disagree all the things you point out.
|
[Steve pulls out a wooden stool and an old pipe...] Way back in the early times, C had an Now, these were hints, and compilers were free to ignore the hints, but programmers expected that the compiler would mostly honor the intent. Yeah, that's crazy, but we were young, and compilers were stupid. Eventually I learned that it's a big world out there, with a zoo of different architectures, register sets, and crazy machine considerations. “But I profiled it!”. On my computer with my compiler of my version at today's date. I remember the day that I spent time optimizing our frequently-called Gaussian elimination matrix code, unrolling a triply-nested loop. It was a proud day, until I profiled the result and found my optimized code was 1,000x slower than the original for-loops three deep. That was the day that I learned that compilers could take advantage of CPU quirks and generate esoteric CISC instructions that perfectly fit the architecture. Later on I learned the lesson again with respect to what happens when you blow the instruction cache, and that small code is often faster than larger code, and in fact that code “optimized for space” would sometimes beat code “optimized for speed”. I was super happy when the At this point, it's been well pounded into my thick skull that compiler writers are pretty darned smart, and I'm frequently not. It's simply not our business whether a function is small enough to be copy-pasted throughout the code or whether some random architecture on some users's computer that I've never touched has optimized calls that yield practically zero overhead due to predictive branching and other things smart hardware folk have created. In my opinion, |
@hollasch After reading this it's all makes sense. Thank you very much for the reply. I think, I miss that generation 😸 I never use One thing I remember about I afraid to sound cocky when I suggest something. I'm probably the least intelligent guy about graphics in the room 😄 |
Sorry if I'm coming across as curmudgeonly without reason. My priorities in
terms of source are
1. No code changes
2. Use C
3. Use the oldest subset of c++
4. Use the smallest subset of new c++
A big part of the above is that I want the books to be as approachable as
possible. I have serious concerns about the approachability of modern c++.
And I'm really not a fan on modern c++ in general.
I'd like to say that Hollasch elaborated what I was trying to go for, but
no, his understanding and explanation is well beyond my own.
Even if you're adamant that you're the least intelligent here, I might
still fight you for the title.
…On Mon, Aug 26, 2019, 04:27 Adem Budak ***@***.***> wrote:
@hollasch <https://github.com/hollasch> After reading this it's all makes
sense. Thank you very much for the reply.
I think, I miss that generation 😸 I never use auto and register keywords
(in C's sense), to be honest never understand its purpose, and use cases.
Whenever I heard about PowerPC or C64 stuff, it's all Greek to me 🤦♂
One thing I remember about inline keyword from Meyers' famous book
Effective C++. I reach out to my bookshelf and read it again, on Item 30,
it's perfectly the case here. inline'ing member function.
I afraid to sound cocky when I suggest something. I'm probably the least
intelligent guy about graphics in the room 😄
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://github.com/RayTracing/InOneWeekend/issues/80?email_source=notifications&email_token=ACNZVKEFAJT7QBSLXKBIZCTQGO4ZPA5CNFSM4IPJX5G2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5ECZVI#issuecomment-524823765>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACNZVKBO6UV6SFVA7AHR6G3QGO4ZPANCNFSM4IPJX5GQ>
.
|
[Brief Steve] I'm leaning toward removing the That said, this is very low priority right now as we focus on the v2 milestone. Parking this for now until post v2. |
Interesting note. On Windows, Visual C++ compiler, release build, I moved the |
Resolved in #226, changes in development branch. |
From the cppreference.com
Some member functions marked as
inline
but it's not necessary as in description.The text was updated successfully, but these errors were encountered: