The problem is that this
struct foo { /*...*/ } * bar;
defines bar
to be a foo*
, not a foo
. Try
struct foo { /*...*/ } bar;
instead.
The problem is that this
struct foo { /*...*/ } * bar;
defines bar
to be a foo*
, not a foo
. Try
struct foo { /*...*/ } bar;
instead.
Are you running a Debug build? Debugging a release build will often seem to work, but the debugger will report garbage values for variables.
If that's not it, then I'd try to verify if it is a compiler/syntax issue by splitting up the definition so you define the struct as a typedef and then define the pointer in a separate statement. (This would arguably make the code more readable/maintainable anyway - if you don't trust the code above then rewriting it in a way that you do trust is advisable)
Try declaring the struct frame
and defining a variable of that type in different statements.
struct frame {
/* .. Various other fields, etc */
struct frame *next;
};
static struct frame *Frame = NULL;
Maybe the static
messes up Visual Studio.
There's something about your situation described by Microsoft: http://support.microsoft.com/kb/822551
WORKAROUND: Microsoft strongly recommends that you use unique type definitions.