(April 24, 2016 at 5:42 am)pocaracas Wrote:(April 24, 2016 at 4:46 am)Cthulhu Dreaming Wrote: These are common in C (specifically the gcc compiler) , and they work exactly the same as ordinary functions - by the time they go from thr pre-compiler to the compiler, they are ordinary functions.C++, it was.
What language/compiler are you talking about?
And the purpose of it was to prevent function calls, added stack, and variable copying/passing.
We may think of those as "fast" events, but when every CPU cycle is precious, any trick is valid... Even if the CPU is an Octa-core, with hyperthreading and churning at some 3.6 GHz (a Xeon, I think it was).
Quote:The weirdest thing I've ever seen is everything written in Perl, ever, that was not used for listing rubbish. I have had to wrote - not by choice - far more Perl than I would wish to admit to.
I've only had to adapt a simple script in Perl, so I can't say much about it.
I'm guessing those pre-processor macros define inline functions - from what you've described.
I never personally got into C++, I did a little bit professionally but I'm far from expert. I would guess 80% of my career has been ANSI C, with most of the rest being Perl and Java.
I definitely agree that in your line of work avoiding a couple of stack operations, etc should be eschewed for keeping it in registers. I can imagine you have data analysis jobs that take hours or days to run. Every optimizion counts when you iterate over that much data.
Of course you already know this, this is more meant for other readers.