I think macros are very useful when you have some libraries or codes that can be configured dynamically depends on the OS, user preferences and so on.
Consider you have a math-library ( lets say the library is in source-form, not a dll) which offers many methods to solve a particle problem, how would you give the end user the possibility to choice his default or preferred method.
Lets say to find the inverse of matrix, your library offers many method and fucntions, but the easiest one may be
1 2 3 4 5
|
// let say MD2 is a 2d array
MD2 a(5,5);
a.randomize();
// the method calculating the inverse
a.inv(); // which methods/algorithm does it use ? is the user enabled to define his default method
|
I think in such cases the macros are very useful and powerful.
If you want to develop cross-platform library/codes you have to use macros.
you can see many example of macros in all C++ large library, as you mentioned from arrays, see also Blitz, eigen, armadillo, hasem and so on.