On Fri, Aug 24, 2012 at 11:08 AM, Diego Novillo <dnovi...@google.com> wrote: > On 2012-08-24 12:03 , Gabriel Dos Reis wrote: > >> I would just use C++ standard function `at()' (e.g. as found in vector<T>) >> for this. > > > Sure. For regular functions, using default-valued arguments would be fine. > But I think the mechanism would be much more transparent if the compiler did > the heavy lifting. > > 1- Add a class/function attribute that makes the compiler add 3 hidden > args for the caller location. > > 2- During code generation, the compiler fills in these values at call > sites. > > 3- The callee accesses these values by referencing specially named > arguments (much like 'this') or via __builtin_* accessors. > I think I prefer using __builtin_*.
I agree. We need to find a way to solve 1. that does not introduce ABI problems for operators. Your idea of backtrace would be a solution, but JSM appears to indicate it entails a non-trivial amount of non-portability... -- Gaby