New troubles

Started by
2 comments, last by SeanHowe 23 years, 9 months ago
Ok, I have something like this code:

class AiNode;
class AiNodePtr {
 AiNode *ai;
};
class AiNode 
{
 AiNodePtr branches[8];
 void SomeFunction()
 {
  ...
  branches[0].ai=new AiNode;
 }
};
 
And it''s causing a windows invalid instruction error when it reaches the part where it''s newed. Any ideas?
Advertisement
Your SomeFunction doesn''t happen to be the constructor does it?

Was it a compile error or a run time error?
Nope, SomeFunction isn''t a constructor. It''s a run-time error. Weird, eh?
Very wierd.
Try using sizeof, to see how big each of your classes is.

It almost has to be the case of SomeFunction being activated in a constructor somehow.

How do you declare the first object of the head object?
Try tracing the code into new to see if you end up somewhere in your code (vs microsoft''s.)

I would have to see more code to help more. What you show is fine.

This topic is closed to new replies.

Advertisement