Structure member definition not recognized

Hi,

I have the following structures:


struct ObjCol
{
char szColName[64]; // column name
ColType colType; // type of data
ulong ulSize; // size
};

typedef enum {
TYPE_INTEGER,
TYPE_STRING,
TYPE_BOOL,
TYPE_RAW,

TYPE_EXT_TIME,
TYPE_EXT_DATE,
TYPE_EXT_TIMESTAMP,

TYPE_CONV_UL_TIME,
TYPE_CONV_UL_DATE,
TYPE_CONV_UL_TIMESTAMP
} ColType;


and I call a method which initializes the ObjCol structure. I call it from MC++ project and from a C++ project. The problem, however, is that when calling it from MC++ the colType member is undefined, at least this is what the debug think, but I looked in memory where the pointer to the ObjCol structure pointer and in both cases I see the exact same thing:

0x03A78B40 69 64 00 cd cd cd cd cd cd cd cd cd id.IIIIIIIII
0x03A78B4C cd cd cd cd cd cd cd cd cd cd cd cd IIIIIIIIIIII
0x03A78B58 cd cd cd cd cd cd cd cd cd cd cd cd IIIIIIIIIIII
0x03A78B64 cd cd cd cd cd cd cd cd cd cd cd cd IIIIIIIIIIII
0x03A78B70 cd cd cd cd cd cd cd cd cd cd cd cd IIIIIIIIIIII
0x03A78B7C cd cd cd cd 01 00 00 00 15 00 00 00 IIII........


Does anybody has an idea where the problem might be.

Thanks a lot.




Answer this question

Structure member definition not recognized

  • ITLionWoo

    Yes, I did have a bug, which resulted in my environment complaining of not being stable, but it was reproducable only under that particular project state and I don't get it any more. Thanks for the advice anyhow, I will open bugs whenever appropriate.

    Angel


  • PjV

    It's not clear what you are asking: the memory dump looks correct. szColName="id" (the 0xcd is benign uninitialized memory), colType = 1 (0x01 0x00 0x00 0x00 in big endian order), and ulSize=31 (hex 0x15).

    If the 0xcd is throwing you off, it may be due to differences in memory initialization in the runtimes. You can initialize it yourself.

    Brian


  • CharlyA

    For the meaning of 0xCD and other values, see this article:

    http://www.codeguru.com/Cpp/W-P/win32/tutorials/article.php/c9535/



  • J1102

    For the record, if you put an unmanaged enum variable in the watch window of VS2005 it will always say undefined. Its a problem with the debugger not the program itself. If you cast the enum to and int then you will see the right number, so it *is* correct. Its just not showing it.

    I think I logged that bug with MS late last year.

    Regards

    Jero



  • GTrz

    Yeah, the debugger does have problems with managed C++. I get sporatic crashes with my code when watching (but not reproducable). If it's reproducable for you, you really should open a bug (with a repro) on it so it doesn't occur again in the upcoming SP1.

    Here's the website: http://lab.msdn.microsoft.com/productfeedback/Default.aspx

    Brian


  • chief_druid_tma

    Hi Brian,

    the issue was that when I added to the watch window of the debugger this structure the colType member was shown as "<value undefined>" or something similar. I assume it is just a bug in the studio, because when I let the program run it used it as a valid value anyhow. That is, the debugger said it is undefined but it actually was.

    Greetings,
    Angel


  • Structure member definition not recognized