answersLogoWhite

0

What are macro's?

Updated: 8/19/2019
User Avatar

Wiki User

13y ago

Best Answer

Macros, which are special lines/fragments of code, differ from any other code written in the source files in the aspect that it's not passed to the compiler (either for the purpose of encoding into machine instructions, or some intermediate form instructions). Instead, macros perform textual manipulations on the source code before passing it to the compiler, where this process preliminary to compiling the source files is called "preprocessing", and the software component responsible of doing it is called the "preprocessor". Henceforth, macros are usually defined as "preprocessor directives", where a segment of code is replaced by the results of the macro processing before passing the source code to the compiler. A very valuable technique to gain a thorough understanding of the operation of macros in any environment is to learn how to obtained the preprocessed source code, and see how the macro directives are expanded.

Preprocessor macros, because of their distinctive nature compared to compiled code, are powerful tools in programming, and that's why the concept of macros is applied in most programming languages, such as the C Programming language, and the assmebly language (where each assembler provides its own macro directives).

Macros should not be confused with other compiled code, and they should be used only while bearing in mind how they work, namely by modifying the source code prior to passing it to the compiler. Trying to employ macros to do jobs that cannot be done before compilation, but rather depends on the program's compiled state or the execution yields is a common mistake that beginners make, mainly those who learn programming by reading others' code, and since a lot of programmers use macros excessively for common programming jobs such as the emulation of constants, it's easy for a beginner to fall into the trap of thinking that they represent a code that is "executed" by the processor in run-time.

The excessive use of macros for purposes achieveable by run-time techniques is not recommended, and somehow deprecated. Nevertheless, macros sometimes are viable tools that has no other alternative, such as the case with assertions. Asserting is very common in defensive programming, and means warning the programmer at run-time if some necessary condition was not met upon execution in the Debug versions of the program, so that appropriate actions are taken in the time of development, while completely/or partially disappearing from the code in the Release version. The problem with the function that is meant to carry out such assertion is subtle, because, such a function is sometimes supposed to keep evaluating the expression even in the Release versions, and, if the expression evaluated to false and this were the debug version, it should output a message with a reasonable indication of that failing expression, usually using the textual C code conveying the expression, as well as the line number at which the assertion was performed and the code file name. This very interesting information CANNOT be obtained, in any means, at execution time, and such functionality is only achieveable via using simple -though powerful, macros. The macro used will take the bare expression and put it in an if statement, then within the statement block it will enclose the expression in double quotations to yield the representative string, while inserting the line number at which the assertion line was mentioned in the source file, plus the source file name, using special macro directives that are simply substituted with such information before compilation.

To learn more about C macros, refer to the famous Kernoghan/Richie's book "The ANSI C Programming Language", the explanations are brief but thorough.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

A macro is a single computer instruction which results in a series of instructions in machine language. Well, in the context of WoW; Blizzard allows users to create their own isolated sections of code behind a command button.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are macro's?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why do you use macros?

Macros are used to automate repetative tasks.


Why you use macros?

Macros are used to automate repetative tasks.


How you run the macros into Microsoft Excel?

You can open the Macros section and run macros from there. The quickest way to do that is press Alt - F8. You can also run macros by clicking on buttons or other objects that you have assigned them to.


How do you get Macros to work on newer versions of Excel?

There can be many reasons why your macros are not working. Check security settings to ensure your version of Excel has macros enabled. Many times, the default installation disables the ability to use macros. Ensure you accept security certificates for the author of the macros.


How do you run VB in Microsoft Excel?

You can do it by creating macros and then editing the macros. The macros or set of code can be applied to a button. It will depend on the version of Excel you have, but you can usually start creating macros or writing code through the Tools menu.


Do word processor support macros?

Some word processor support macros, some does not.


Where can you download macros?

You do not really download macros, but you can get lists of code to create your own macro. There are many locations you can find if you search for "sample excel macros." You will find some examples at the related links.


Where can i download a runescape woocutting macro?

Don't use macros jagex can detect all macros and you will be permanently band


What is Macros in access?

Answer the question, i need the answer..


Different types of macros in assembler?

Types of macros In general, there are two types of macros: ExecutiveThese macros generate either code or data that is incorporated into the program being assembled.Generally, an executable instruction is generated.DeclarativeThese macros produce information used by the assembly process while generating code.z/TPF system programs use a large set of macro instructions to generate linkages or to simply generate inline code. Many of these macros are restricted to system programs because the macros are subject to change in future releases and represent an unprotected interface. A macro with an unprotected interface is called a system macro. Because some z/TPF system programs run in the application execution environment, some of the system macros also generate SVC linkages.


What are possible limitations using macros within Microsof Excel?

What are possible limitations using macros within Microsoft® Excel


What are the icons in Microsoft Word 2007 and their functions?

Word 2007 file extensions have been changed as noted below :Type FileWord 2007 document without macros .docxWord 2007 document with macros .docmWord 2007 Template without macros .dotxWord 2007 Template with macros .dotm