根据C++标准,见reinterpret_cast
of a pointer T*
to some other category pointer Q*
can 视执行情况变化或改变点值。
I m 非常感兴趣的是,在C++实施方面,有实际的例子,在C++实施过程中,用reinterpret_cast<>/code>将一个点放在另一个点。 点名的改动? 在那里发生了什么变化?
根据C++标准,见reinterpret_cast
of a pointer T*
to some other category pointer Q*
can 视执行情况变化或改变点值。
I m 非常感兴趣的是,在C++实施方面,有实际的例子,在C++实施过程中,用reinterpret_cast<>/code>将一个点放在另一个点。 点名的改动? 在那里发生了什么变化?
请注意,当标准规定它能够或不可能做些事情时,这并不意味着目前实施这种行为,只能是可能。
我认为,最接近的是硬件要求进行类型调整的架构,以及决定在必要时纠正一致性的实施。 类似:
aligned8 var;
aligned1 *p = reinterpret_cast<aligned1*>(&var);
aligned1 *q = p + 1; // assuming aligned 1 size is not multiple of 8
aligned8 *a = reinterpret_cast<aligned8*>(q); // [1]
可能需要要求将<代码>a作为有效参照点,必须处理8个以上的记忆,而“代码”>>>/代码”的表述要求较少,可指任何记忆地址。
class A1 { int a1; };
class A2 { int a2; };
class B: public A1, public A2 { };
#define DBG(val) cout << #val << ": " << val << endl
// test code
B b;
DBG(&b); // prints 0x42
void *p_blank = &b;
DBG(p_blank); // prints 0x42
A2 *p_a2 = &b;
DBG(p_a2); // prints 0x46
void *p_reinterpreted = reinterpret_cast<A2*>(&b);
DBG(p_reinterpreted); // prints 0x42
A2 *p_reinterpreted2 = reinterpret_cast<A2*>(&b);
DBG(p_reinterpreted2); // prints 0x42
A2 *p_a2 = &b
means give me the pointer to an A2 object within the B object.
reinterpret_cast<A2*>(&b)
means give me the pointer to b and treat it as an A2 pointer.
The result of this reinterpret_cast has the type pointer to A2 , therefore it produces no warning when assigned to a void* variable (or to a A2* variable).
最常见的麻烦来源是病媒机器,根据病媒对ar体操作进行定义,而ar点机由病媒的点子组成,其指数为病媒。 从历史上看,最初的Cray结构就是这样,它造成了头痛。 现在,你可能看到像在万国邮联这样的东西,但我可以指出我头顶上的东西。
最可能的影响是拖拉,因为目的地类型缺乏具体指数部分的参照标准。 C++11通过允许任何点形形形形形形形形形形色色码,只要它们有相同的协调要求。 严格调整的“零化”范围是不允许的。
An object pointer can be explicitly converted to an object pointer of a different type. When a prvalue v of type “pointer to T1” is converted to the type “pointer to cv T2”, the result is
static_cast<cv T2*>(static_cast<cv void*>(v))
if both T1 and T2 are standard-layout types (3.9) and the alignment requirements of T2 are no stricter than those of T1, or if either type is void. Converting a prvalue of type “pointer to T1” to the type “pointer to T2” (where T1 and T2 are object types and where the alignment requirements of T2 are no stricter than those of T1) and back to its original type yields the original pointer value. The result of any other such pointer conversion is unspecified.
我认为,在C++和C点er中,这个问题是有意义的。 https://stackoverflow.com/questions/916051/are-there-are-any-platforms- where-pointers-to-different-types-have-different-size> 页: 1 我仅举一个例子:
数据总则的Eclipse MV系列有三种建筑支持的点码格式(词、斜线和轨道点),其中两种由C汇编者使用:
char*
和void*
的星号,以及所有其他用途的字标。
这表明“Recode>reinterpret_cast<Word_Comm_Type*>(char*)
Reinterpret_cast从来不会回一个不同的地址,需要复制准确地址。
在Catherine、Peter、A.K.、A.、A.K.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、A.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.R.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、E.、 Re>,<>,<<>,但>,如在>,<>,>>。
预测时,静态预测会退回一个与所给出地址不同的地址。 如果你们的地址是基地之一,而这一地址正被打上第一个基址的冲抵,静态预测将退回一个被预测物体的有效地址,该地址等于第一个基点的地址,因此不等于点子。
简明扼要:重新解释后,总是给你同样的地址。 法定的播种和动态的播种可能退回不同的地址,例如,在某些涉及多重遗产的情况下。
静态预测和动态预测之间的差别是,静态预测没有检查你给出的点子是投射物的正确标的,因此在提播前肯定如此。
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 ...
I have been searching for sample code creating iterator for my own container, but I haven t really found a good example. I know this been asked before (Creating my own Iterators) but didn t see any ...
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 ...
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?
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->...
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, ...
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 ...
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?