考虑以下两个方案: #include <stdio.h>
int main()
{
int z = 6.4;
printf("%d %d", z, 6.4);
return 0;
}
输出为6 -1717986918。 #include <stdio.h>
int main()
{
int z = 6.4;
printf("%d
假设我有一个基地structFOO基本上是一个C风格struct: struct FOO
{
double bar1;
int bar2;
};
和C++式struct(其具有成员函数,没有构件数据,但没有v表): struct bar : public FOO
{
double getBar1() const;
int getBar2() con
假设我有一个类A: class A : virtual SomeOtherClass{
//Stuff here
};
假设我有这样做的地方: A thing;
alignas(A) uint8_t arr[sizeof(A)];
for (int x = 0; x < sizeof(A); x++)
{
//Copy into array
arr[x]