On Wed, Aug 15, 2012 at 4:37 AM, Richard Guenther <rguent...@suse.de> wrote:
>
> I face an issue with replacing macros with C++ functions and the
> way we implement gather-detailed-mem-stats.  Currently the
> mem-stat info is passed at the call site of functions via macros
> like
>
> #define VEC_safe_grow_cleared(T,A,V,I)                  \
>         (VEC_safe_grow_cleared_1<T,A> (&(V), (int)(I)   \
>                                        VEC_CHECK_INFO MEM_STAT_INFO))
>

Not every CPP macros can be simply and perfectly
replaced by a C++ template.  CPP macros fundamentally operate at
levels not understood by the language core semantics, for good or bad.

You might try to encode/package information with the
parameters T and A, but essentially you will hit the wall
that __FILE__, __LINE__, and __FUNCTION__ are CPP artifacts.

Unless we are willing to fundamentally change the way our
current allocators work, I fear we would have to live with
these parts of CPP.

-- Gaby

Reply via email to