answersLogoWhite

0


Best Answer

Definitely functions, since they provide type safety. Many macros also generate unwanted behavior, because of the way they're expanded. In my opinion, just use inline functions, but if it seems appropriate to use macros, use them -- but do so, with caution.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Which is preferred to use in a program Macros or functions?
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 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.


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 the difference between macros and constant variable?

Macros are processed at preprocessing time where as constant variables are processed at complie time. Macros doesnot have any scope but constant variables has scope. Macros doesnot have the type checking where as constant variables have type checking.


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.


The max number of functions you have used in a c program?

There is no limit to the number of functions you can have in a program. The only practical limit is dependant upon the amount of memory you have available in order to load the compiled program, whether it has 4 functions or 4 trillion functions. If the program makes use of dynamic libraries, then the amount of available memory reduces accordingly.


When to use macros?

You can use macros to say Grats or Thx in guild chat , Cast spells , Sell in /2 trade and alert healer if you are dieing in raid , bg or Instance.


How is the use of a pelvic ultrasound beneficial?

Ultrasound is a preferred method of examining the pelvis, and functions as an extension of a physical examination, particularly for obese patients.


What is a Macro in Excel?

Macro is feature in MS Excel software which records all the steps and all the steps can be repeated whenever a same task is required to be performed. It helps in reduction of time in performing monotonous task. Macro is available in Tools menu.


How do you write a c program to calculate the circumference of the circle using macros with parameters?

// macro definitions: #define PI 3.14159265358979323846 #define CIRCUMFERENCE(radius) (2. * (radius) * PI) // use this as in CIRCUMFERENCE(21.34)


What is the difference between macro and inline function in c plus plus?

Macros are not actually part of the C++ language; they are nothing more than a simple text-replacement system intended to simplify your coding. Macros do not adhere to C++ type safety and cannot be debugged because macros are preprocessed, prior to compilation. Your compiler can only see the preprocessed code, not the original source code, and therefore cannot debug macros because the macros no longer exist at that point. Inline functions are functions that can be debugged like any other function, but the compiler is able to eliminate the overhead of function calla by replacing those calls with inline expanded code. This is not unlike a macro, which is by definition inline expanded, but retains the built-in type safety and debugging capabilities of the C++ language itself. Typically, if you can use an inline function (or C++ is general) then that is always the preferred option. But if a macro can achieve more than can be achieved with C++ alone, or can otherwise simplify the equivalent C++ code, then use a macro. Just keep in mind that macros are not type-safe and cannot be debugged by the C++ compiler.