
Watching static variables doesnt work in MSVC 4.2 but does in 5.0
In 4.2
I have declared two static variables at file scope with the same
name in two different files. However they point to different structures
(see below). When I enter main() and quickwatch max_vtx it returns
the vertexuv format instead of vertex. If I delete textarb.c then max_vtx
returns the correct data structure and I can assign the pointer OK.
In 5.0
It works as I expect.
I use MSVC4.2 over 5.0 as it has direct cable connection support.
Is this a known bug ? is there a workaround ? or am I doing something
silly ? Any help appreciated.
TIA
#ifdef __cplusplus
extern "C" { // Assume C declarations for C++
#endif // __cplusplus
#ifndef _MISC_H
#define _MISC_H
typedef struct tagVertex
{
long x,y;
Quote:
} vertex;
typedef struct tagVertexuv
{
long x,y;
long u,v;
Quote:
} vertexuv;
#endif
#ifdef __cplusplus
Quote:
}
#endif
//MAIN.C
#include "misc.h"
extern void textarb( void );
static vertex *max_vtx;
void main( void )
{
static vertex *ptr_vtx;
vertex test_vtx;
test_vtx.x = 1; test_vtx.y=2;
max_vtx=&test_vtx;
textarb();
Quote:
}
//TEXTARB.C
#include "misc.h"
static vertexuv * max_vtx;
void textarb( void )
{
vertexuv test_vtx;
test_vtx.x = 1; test_vtx.y=2;
test_vtx.u = 3; test_vtx.v=4;
max_vtx=&test_vtx;
Quote:
}