TransformNode with 4 bytes to alignment boundary
什么意思错误:...在Xcode/Clang中的“字节到对齐边界”?
这里是导致此警告的代码:
class TransformNode : public Node {
public:
int number;
public:
void test() { number = 12; }
};
//Node.h
class Node {
public:
typedef std::set<Node *> ChildSet;
protected:
ChildSet mChildren;
Node * mParent;
public:
Node(Node * parent=0) : mParent(parent) {}
~Node() {}
Node * addChild(Node * node);
inline Node * getParent() { return mParent; }
const ChildSet &getChildren() const { return mChildren; }
};
inline void node_test() {
TransformNode * node = new TransformNode;
node->test();
std::cout << node->number << "\n";
}
int main() {
node_test();
return 0;
}
当我从类的transformNode得到节点类的错误发生。我正在使用xcode 5.0,并且所有警告都已打开,并将警告视为错误。我真的很想了解这段代码究竟发生了什么,所以只需关闭警告或停止处理它们,因为错误不是我想要处理的方式。
编辑:增加了更多的代码。澄清一些细节(粗体)
感谢,
卡西姆
发布更多代码。 –
我应该添加更多的代码吗? – Gasim
*我应该添加更多的代码吗?* **是**。您仍未显示将节点转换为Transform节点的位置。如果没有那些关键的代码,我们怎么能告诉你哪里出错了? –