开发者

Visual Studio: Inconsistency in method header

开发者 https://www.devze.com 2023-01-10 10:51 出处:网络
I have a method in C++: HRESULT Foo(const ULONG bar, const ULONG baz, ODP& odp) ODP is typedef\'d to unsigned short.

I have a method in C++:

HRESULT Foo(const ULONG bar, const ULONG baz, ODP& odp)

ODP is typedef'd to unsigned short.

When I call this method, I get a VS runtime check error when the calling method ends: "The stack around odp is corrupted."

When I look at t开发者_如何学Gohe method being called, and hover my mouse, VS pops up this description:

Foo(const unsigned long, const const unsigned long, const unsigned short * const)

Why the inconsistency? Why the two consts for the middle param? Why isn't the last param ODP&?


Check to make sure you don't have two different definitions for Foo or ODP. If one definition is seen in one context and another somewhere else, you enter the land of undefined behavior.


Possible answer: the VS debugger is getting its info from the machine code, not from the source.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号