XSPEEDOPT is defined if I feel like optimizing speed (like inlining etc). When I do that, the macro does not work 0.o The output hash of, such as a SHA1, is invalid, but if I use the actual functions, it works... lolwut?
What on earth makes you think a macro would be faster than an inlined function?
Ditch the macro - worrying about why it doesn't work is a waste of time.
A macro is no faster. In fact, it can be slower since it *forces* the compiler to inline the function, even if it would slow down the program. Just use an the inline keyword and let the compiler do the hard work for you.
I'm working on a cross platform project... windows only can do inlining... so I would like to do a macro where i can cause that can be interpreted on other platforms
And I disabled inline checks, i have it inline everywhere i choose to
Probably because you're compounding statements when you pass them, causing the macro to expand in a way you didn't expect (yet another reason why they're evil)
1 2 3 4 5 6 7 8 9 10 11 12 13
#define TEST(a,b) a*b
int main()
{
int foo = 3;
int test = TEST(3,foo+4); // you expect test to be 21, right?
cout << test; // SURPRISE, it's 13!
// TEST(3,foo+4) gets expanded to 3*foo+4 which evaluates as (3*foo)+4
// not as 3*(foo+4) as you'd expect
}