3 ms·
I have seen this kind of ”flip-flop” behaviour people have with macros a few times. First you go all in, burn yourself, and then go to the other extreme. Perso
by arka2147483647 4y ago
I have seen this kind of ”flip-flop” behaviour people have with macros a few times. First you go all in, burn yourself, and then go to the other extreme.
Personally, i think macros are a good way to automate some common tasks, but you have to be carefull to keep them short. Also it is a good idea to prune macros periodically to remove what you dont need.
In Cpp, If you find yourself choosing weather to use a macro or a template; Choose the one which is more terse!
Also macros will always inline in debug while templates will generate functions in debug builds, without optimizations. This may be an important performance consideration at times.
- WalterBright 4y agoD has an "always inline" annotation for functions, so they'll be inlined even in debug builds if so desired. Using a symbolic debugger with macros is just another facet of the slow moving disaster of macro usage.