Alexander
Mon Jul 23 13:38:58 CDT 2007
In reality, nothing prevents mixing the two. The macro can simply
call a function after all, or perform a simple if and call different
functions as the case may be. More complex macros usually do
more harm than good...
Also note, if you are optimizing for size than for speed, using
inline functions can be optimized by disabling inline expansion,
but using inline code via macros can't.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ:
http://vcfaq.mvps.org
=====================================
"Tom Serface" <tom.nospam@camaswood.com> wrote in message
news:A80EA6FD-D557-4C1A-9064-CD36D95AE99B@microsoft.com...
> BTW, I agree that inline functions are a much better choice than writing
> "functions" using macros so we're actually agreeing even though I'm sort
> of doing it in my usual obtuse way :o)
>
> Tom
>
> "Doug Harrison [MVP]" <dsh@mvps.org> wrote in message
> news:khj4a35l53o5qt0u6op7erj3b7cf3oup3r@4ax.com...
>> On Fri, 20 Jul 2007 22:35:11 -0700, "Tom Serface"
>> <tom.nospam@camaswood.com> wrote:
>>
>>>Hi Doug,
>>>
>>>You're right in general of course, but I still think macros are handy for
>>>lots of things like:
>>>
>>> #define LogCriticalEvent(val) theApp.LogEventObject._LogEvent(#val, val,
>>>_T(__FUNCTION__), __LINE__, 0, true)
>>>
>>>Where this would be more difficult to do in a function.
>>
>> Sure, you have to use macros for that. I guess it would be more accurate
>> to
>> say that when you have a choice, inline functions are preferable to
>> macros.
>>
>>>I kind of miss
>>>being able to do this sort of thing when writing C# code :o)
>>
>> C#, what's that? :)
>>
>> --
>> Doug Harrison
>> Visual C++ MVP
>