![]() |
|
#1
|
|||
|
|||
difference between inline function and macro functionhi,
i would like to know difference between inline function and macro in c++. Given an option , which one should be used or given preference over the other??? |
|
#2
|
||||
|
||||
Re: difference between inline function and macro functionInline functions anytime win over Macros..atleast It gives you a chance of writing a better code(though no guarantees). macros are simply evil most of the time.
__________________
Gravitation is not responsible for people falling in love. -Albert Einstein |
|
#3
|
|||
|
|||
Re: difference between inline function and macro functionI agree with alcoholic, but the OP also asked for an explanation of the difference.
Observe this code, which uses a macro function and an inline function for the same purpose: CPP / C++ / C Code:
By the way, the nature of macros creates a huge number of headaches and potential gotchas, which I won't go into here, but they more than justify alcoholic's statement. You can find many rants about this on Google. |
Recent GIDBlog
Observations of Iraq by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| determinant algorithms | Blake | C++ Forum | 11 | 13-Mar-2006 18:36 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The