English 中文(简体)
是否用提及地址有力退回了基本物体的地址?
原标题:Does taking the address of a reference robustly return the address of the underlying aliased object?

如果C++方案使用“和”设计;操作者通过参考处理提及的一个物体,那么返回的地址是否真的是背后物体的地址,还是可能提及该物体的临时情况?

例如:

T a[2];

void g(T& b) {assert ((&b + 1) == &a[1]); }

int main () { g(a[0]); return 0; }

C++标准是否证明上述说法总是真实的,或者为了优化的目的,有可能说,汇编者可能会造成临时的[0],指的是临时的,然后是返回,将临时背书的价值输入[0]?

我承认以下声明:。 提及地址是否总是等同于原地址? 然而,没有提及支持这一说法,我并不肯定这是否是无条件的。

根据C++标准,未说明是否需要储存提及。 另一方面,它也说,用提及地址给你提及人的讲话。 因此,即使汇编者选择与内部参考资料分开储存,其地址也相同。

问题回答

“是否用提及地址积极回馈基本物体的地址?” - 是

如果你在发言时提到,你获得的是参考对象的地址。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签