The task is as follows:
Give examples of the abandonment of object macros and macro functions in favor of language constructs that are not related to the preprocessing stage.
I can’t imagine what the answer might be.
The task is as follows:
Give examples of the abandonment of object macros and macro functions in favor of language constructs that are not related to the preprocessing stage.
I can’t imagine what the answer might be.
Source: https://ru.stackoverflow.com/questions/570420/
All Articles
#define sqr(x) x*xis bad.template <class T> inline auto sqr(T x) -> decltype(x*x) { return x*x; }template <class T> inline auto sqr(T x) -> decltype(x*x) { return x*x; }- good. Why?sqr(i++);. And in the template also type checking can be added. - int3