C++ and gather-detailed-mem-stats

Gabriel Dos Reis gdr@integrable-solutions.net
Wed Aug 15 10:57:00 GMT 2012

On Wed, Aug 15, 2012 at 5:11 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 08/15/2012 12:07 PM, Gabriel Dos Reis wrote:
>> 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.
> GNAT has built-in functions which return this information.

This is a very sensible thing to do.

> When they are
> used in default argument expressions and these arguments are omitted, the
> functions are evaluated in the context of the caller and return the file
> position at that point.  Perhaps that would be an approach for C++ as well?

C++ already has the rule that default arguments are evaluated at the call
site, so this is definitely something to consider for stage 2 and higher builds.
For stage 1 builds, I suppose one would have to fake it and leave
with the imprecision that is bothering Richard?

> (This assumes that gather-detailed-mem-stats is not needed in the first
> stage compiler.)

it is built into stage 1 compiler, but I doubt that stage 1 compiler is
really useful to the kind of detailed statistics that would require this.

-- Gaby

More information about the Gcc mailing list