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節點的位置。如果沒有那些關鍵的代碼,我們怎麼能告訴你哪裏出錯了? –