English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

5 answers

In what language? In C, it was common for small utility services where people didn't want the overhead of a function. With the introduction of inline functions in C++, macros have been deprecated. They were often bad news anyway, because of side-effects.

2006-07-03 16:46:26 · answer #1 · answered by Flyboy 6 · 1 0

Actually, when you say MACRO, this usually mean a set of commands...

When you make a function, you will define a step by step solution on what the function is intended to do...

The purpose of a macro is to automate common task in a single command or enabling a more powerful abstract.

2006-07-03 23:52:26 · answer #2 · answered by jackal888 2 · 0 0

Use macros for very short functions, i.e. one that would require simple selection or plain calculation. Use functions if the implementation would require blocks of code.

2006-07-03 23:48:35 · answer #3 · answered by Melvin 4 · 0 0

a macro generally generates inline code. There is no context switching, so it is faster than a function, particularly in inner loops.

2006-07-03 23:45:41 · answer #4 · answered by Computer Guy 7 · 0 0

Does the tool you are using have functions?

2006-07-03 23:44:04 · answer #5 · answered by changmw 6 · 0 0

fedest.com, questions and answers