Madan U Sreenivasan wrote:
> On Thu, 06 Jul 2006 17:38:57 +0530, Malcolm Rowe
> <malcolm-svn-dev@farside.org.uk> wrote:
>
>> On Thu, Jul 06, 2006 at 05:44:45PM +0530, Madan U Sreenivasan wrote:
>>> On Thu, 06 Jul 2006 17:08:03 +0530, Malcolm Rowe
>>> <malcolm-svn-dev@farside.org.uk> wrote:
> [snip]
>>>> Are these public functions? (I haven't looked). If so, making them
>>>> macros would mean that we couldn't change the implementation, which
>>>> might be a good reason to keep them as functions.
>>> no these are static functions.
>>>
>> Ok, so what's the benefit of using a macro here? (which is what I should
>> have asked first).
>>
>> The compiler can easily inline a static function if it thinks that's
>> the right thing to do (given the current optimisation settings), and
>> functions have argument type-checking and obvious side effects, which
>> macros don't.
>
> I think its better to have single line functions as macros, than rely on
> the compiler to detect it.
>
It is not a matter of detection. GCC knows better than you do what it
should be inlining.
Also, macros are still impossible to debug without using special options
to the compiler to generate macro debug info (in gcc's case, -g3).
There is simply no advantage to making it harder to debug by using
macros here. This is not performance critical code, and the compiler is
going to inline it anyway.
--Dan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jul 7 13:48:12 2006