最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c++ - Are template arguments accurate in Visual Studio's "Call Stack" window? - Stack Overflow

programmeradmin2浏览0评论

I am observing inconsistent template arguments shown in Visual Studio's "Call Stack" window.

Here's one example:

template<class T>
class Class {
public:
    Class() { method(); }

    void method() { int i = 0; }
};

template<int I>
class ArgumentClass {};

int main() {
    Class<ArgumentClass<100>> instance100;
    Class<ArgumentClass<150>> instance150;
    Class<ArgumentClass<200>> instance200;
    Class<ArgumentClass<250>> instance250;
}

Note that while Line 14 is executed with a value of 150, the call stack shows a value of 250. Why is that?

Note that this is in Debug mode, so I would not expect any optimization.

I even see more complicated cases where the arguments differ from one function call (on the same object) to the next:

发布评论

评论列表(0)

  1. 暂无评论