[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Why aren't people programming everything inline for maximum

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 36
Thread images: 2

File: hqdefault[1].jpg (41KB, 480x360px) Image search: [Google]
hqdefault[1].jpg
41KB, 480x360px
Why aren't people programming everything inline for maximum gains and throughput?

inb4 goto is bad
>>
>>61390853
>15,000 lines of code goes in to a single file - the thread
>>
>>61390853
Almost every modern compiler do that for you.
>>
>>61390881
That's false for many languages.
>>
Because it's not effective
>>
What does that mean, programming inline? What's the alternative?
>>
Because inlining does more harm than good.
>>
>not programming your entire program in header files
>>
>>61390853
GOTO is bad, because Dijkstra have said so
>>
>Not coding all of your work in Assembler
>>
>>61390853
Found the guy who has no clue about programming
>>
>>61391211
Usually you write the declaration of classes and functions in .h files an than you implement them in a .cpp
>>
compilers are typically Smart Enough to inline when it makes sense
>>
>>61391309
Unless you declare the functions as inline
>>
>I prefer bloated binaries
>>
>>61391331
Exactly but that is not a good idea in the majority of the times, you should almost never use inline functions and let the compiler to optimize it, unless you are working on max efficiency and unsing an inline declaration gives you a tangible gain in performance
>>
>>61390989
The inline keyword in C++ is a suggestion to the compiler.
>>
>>61391500
No,it is not a suggestion to the compiler, the inline keyword will make function treated as inline even if is not declared inline together with the declaration
>>
>>61390853
Using Turbo C++ in DosBox, how shitty your college can be. kek.
>>
>>61390853
Do you even know what inlining means?
>>
>>61391697
Wrong. >>61391500 is correct.

Same as using volatile or register
>>
>>61390853
I, too, enjoy raping the i-cache of my processor.
>>
>>61391020
false
>>
File: index.jpg (3KB, 233x216px) Image search: [Google]
index.jpg
3KB, 233x216px
>>61390853
inline for C++ is a serious boost in performance. If I'm iterating line by line of a file over 2Gb, an inline function that compares two variables runs nearly 100x faster if I don't inline it at all
>>
>>61391302
>John Carmack has no clue about programming
http://number-none.com/blow/john_carmack_on_inlined_code.html
>>
>>61393699
>Trusting a criminal.
https://venturebeat.com/2017/02/02/oculus-john-carmack-vents-about-500-million-zenimax-jury-verdict/
>>
>>61393834
>thinking this is a criminal act, and not that the ip system in itself, and the jews that are zenimax are the real criminals
>>
>>61393018
volatile is NOT just a suggestion, since the compiler has no way to know if another source will be modifying the variable or not. if you mark something as volatile, the compiler will respect that.
register and inline ARE suggestions though. in fact, i think register will be deprecated either this standard or the next one.
>>
>>61394481
register is already deprecated
>>
>>61391500
>>61391697
>>61393018
both are wrong, inline has nothing to do with inlining a function anymore. It now means "multiple definitions are permitted"
>>
>>61390853
If they were always faster then everything would be inlined.

They're not always faster so you should use the inline keyword to suggest inlining. Also the compiler will inline anything whenever it thinks it'll make your program faster
>>
>>61390853
Inline functions are not always faster. If you have the same function called repeatedly in succession, then you're going to get many more cache hits than if you inline it at all those call sites.
Also C++'s antiquated linkage model limits the amount of inlining you can do.
>>
>>6139083
HEY GUYS MY NAME IS PAJEET AND I AM NEW TO THE 4CHANS. CAN SOMEONE TELL ME IN PLAIN ENGLISH WHEN TO INLINE AND WHEN NOT TO INLINE

THOUSAND THANK YOUS
>>
>>61395915
Hello Pajeet my name is Ho-Li-Fuk I would also like to know when to use inline.
>>
>>61395915
>>61396001
samefagging larper
>>
>>61394989
Sasuga C++.
Thread posts: 36
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.