Thread overview
Object array crash
Mar 03, 2004
Riccardo Macri
Object array crash - any comments?
Apr 07, 2004
Riccardo Macri
Apr 07, 2004
Walter
March 03, 2004
This crashes (between "2" and "3") unless the destructor is enabled. The code it was derived from worked under SC7.5.

Apologies if I've misunderstood the use of object arrays!

regards,
Rick

---

#include <stdio.h>

//
// Compile: sc test2
//
// This program crashes. If USE_DESTRUCTOR is enabled, its OK
//

//#define USE_DESTRUCTOR 1

class Test2
{
int foo;

public:

Test2();

#ifdef USE_DESTRUCTOR
~Test2()   {}
#endif
};

Test2::Test2()
{
foo = 123;
};

main()
{
printf("1\n");
Test2 * ptr = new Test2[500];
printf("2\n");
delete [] ptr;
printf("3\n");

return 0;
};


April 07, 2004
Any comments on why my previous posting (3rd of March) crashes?

Its repeated below.

thanks
Riccardo

In article <c24rsr$12fo$1@digitaldaemon.com>, Riccardo Macri says...
>
>This crashes (between "2" and "3") unless the destructor is enabled. The code it was derived from worked under SC7.5.
>
>Apologies if I've misunderstood the use of object arrays!
>
>regards,
>Rick
>
>---
>
>#include <stdio.h>
>
>//
>// Compile: sc test2
>//
>// This program crashes. If USE_DESTRUCTOR is enabled, its OK
>//
>
>//#define USE_DESTRUCTOR 1
>
>class Test2
>{
>int foo;
>
>public:
>
>Test2();
>
>#ifdef USE_DESTRUCTOR
>~Test2()   {}
>#endif
>};
>
>Test2::Test2()
>{
>foo = 123;
>};
>
>main()
>{
>printf("1\n");
>Test2 * ptr = new Test2[500];
>printf("2\n");
>delete [] ptr;
>printf("3\n");
>
>return 0;
>};
>
>


April 07, 2004
No, not yet, sorry.

"Riccardo Macri" <Riccardo_member@pathlink.com> wrote in message news:c51m64$10hr$1@digitaldaemon.com...
> Any comments on why my previous posting (3rd of March) crashes?
>
> Its repeated below.
>
> thanks
> Riccardo