They both do pretty much the same thing: they both generate code. However, macros are not type-safe, they aren't even type-aware. So if a function body has to generate a type from its argument, then you cannot use a macro, you must use a template. Even if that is not an issue, the lack of type-safety is a major drawback in a strongly-typed language like C++. Remember, macros are not part of the language itself, they simply exist to augment the language by providing simple text replacements, ultimately making code easier to read and understand. Using them in place of function or class templates is never a good idea no matter how simple the function or class. A bit of extra typing can save a mountain of headaches.
The biggest problem with macros (besides their lack of type awareness) is that they are extremely difficult to debug because they are inline expanded by the preprocessor. This means that if the compiler detects and error, it can only do so in the expanded code which simply doesn't exist in your source code. This also means you cannot set breakpoints in a macro because the macro won't physically exist in the preprocessed code.
Macros can be used to generate any code except the definition of another macro. This can be extremely useful and is extremely powerful when used appropriately. However, templates can only generate explicit dynamic data types and explicit function overloads. A macro that merely emulates a template is therefore not a particularly useful macro, it is an abhorrent abuse of the language and its compiler. The compiler is there to help you so you are encouraged to enlist it as much as possible.
The min/max macros are often quoted as being simpler and easier to use and understand than their equivalent template functions. However, they actually demonstrate why macro functions are so bad in the first place. Calling max(++a, b++) will quickly dispel any myths about macros being easier to work with.
Macros completely ignore namespaces and scope, which can result in name clashes that will produce some really funky code. By contrast, templates are fully namespace and scope aware.
macro-The climate of a large geographic area. micro- is a local atmospheric zone where the climate differs from the surrounding area
Can't beat the Siemens!
marco expand where it invoked ,subroutine will go where the subroutine is defined....
The macro content.
A macro processor processes macros. So what do you think a macro call does, play the flute. The answer is in the question and that begs the question of are you suited to computer programming specifically and an education in general. You are showing a marked reluctance to thinking.
In enumeration, values can be generated for us but in macros we have to give value for every macro template and type checking can be done in enums.
Macro is big micro is little
Calling a macro loads the macro into memory, while executing the macro runs the macro.
macro is bigger than micro
The difference between macro and micro decomposers is micro decomposers can't be seen by the naked eye while macro decomposers are big enough so they can be seen.
difference document and presentation
t s the difference between micro and macro process in the ecosystem?
ten difference of micro economics macro economics
nuguu
micro is on a small scale and macro on a larger scale
macro- and microeconomics courses (the "big picture" versus individual companies/persons)
The same as the difference between huoses and oranges. Did you mean "macro" instead of "marco"?