C++ : if I don't like the name of a command...
Community Forums/General Help/C++ : if I don't like the name of a command...
| ||
... is it possible to rename it in C++ using something called a macro or something without a speed loss? ie... Function thingy(a) { poo(b); } but without the function call overhead, ie some kind of preprocessor so that whenever I write thingy, the compiler puts poo there instead? |
| ||
#define A B Replaces A with B. So.. #define foo bar transforms foo(1, 2, 3) into bar(1, 2, 3) Generally not a good idea to do this though, since it'll make your code very confusing when you have to look up what a macro does when you can't remember its purpose. |
| ||
Thanks a lot :) I am a stubborn git tho... gotta make wheels square sometimes. |
| ||
Defines seem to disable intellisense too in many IDEs. I prefer the wrapper approach although theres probably a minute speed loss over several looped hits. (although i am a relative noob so what do i know :) |
| ||
I prefer the wrapper approach although theres probably a minute speed loss over several looped hits. (although i am a relative noob so what do i know :) Bit of a noob to C++ myself, but if you 'inline'ed those wrapper functions, wouldn't that eliminate the speed loss? I know technically inline is only a suggestion that the compiler can ignore, but that doesn't seem to happen very often, and inline is intended for very short functions as with a wrapper. |
| ||
Hmmm.. handy to know :), Might be useful for my c++ "b3dlikeeasyirrlicht" wrapper thingy i am making. |