none
C++/CLR Bug? RRS feed

  • Question

  • Hi, I want to know if this is a bug in the compiler or their is something wrong with my code

    I get garbage value printed on the output screen ( I guess that the compiler is not passing the values correctly, that double thunking stuff isnt working).

    //compile with /CLR (VS2005:sp1, vs2008)

    class A

    {

    public:

    A(char *c)

    {

    printf("this %x\n",this);

    strcpy(m_c,c);

    }

    char m_c[4096]; //use high memory >=4096

    ~A(){} //to reproduce this bug

    //Do not provide copy constructor
    };

    class B

    {

    public:

    B(char *c)

    {

    printf("this %x\n",this);

    strcpy(m_c,c);

    }

    char m_c[4096];

    };



    void func(A a="2",B b="1")

    {

    printf("%s:%x %s:%x\n",a.m_c, &a, b.m_c, &b);

    }

    int _tmain(int argc, _TCHAR* argv[])

    {

    func();

    return 0;

    }

    Friday, March 13, 2009 5:44 AM

Answers