Tech Off Thread

1 post

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Strange problem with enum array in managed C++ (VS 2003)

Back to Forum: Tech Off
  • User profile image
    Dazraf

    Hi

    Would very much appreciate some help with this.

    Here's a simple program in MC++ VS2003:

    public __value enum GS : unsigned int
    {
        PSP = 1,
        NintendoDS = 2
    };


    int _tmain()
    {
        GS systems __gc[] = new GS __gc[2];
        for (int i = 0; i < 2; i++)
        {
            systems[i] = GS::NintendoDS;
        }

        for (int i = 0; i < 2; i++)
        {
            Console::WriteLine(__box(systems[i])->ToString());
        }
        return 0;
    }

    The code correctly writes out the values within the array.

    However when I break point on any line after the first loop has completed, the debugger reports the contents of the array to be

    -    systems    {Length=2}    GS[]
        [0]    <undefined value>    GS
        [1]    <undefined value>    GS

    Have tried deriving GS from int w/o success.

    Right now it's hampering my debugging in a much larger project.

    Any clues much appreciated.

    Kind regards,
    Dazraf.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.