Loading ...
Sorry, an error occurred while loading the content.

Re: [blug-prog] C++ destructor related problem.

Expand Messages
  • Om Narasimhan
    ... Wrong logic it seems. you have i=0 (I think you meant 0 == i) Assume nRows = 10 before the loop, then, for ( i = 9, 0 == i, i --) {...} Won t execute,
    Message 1 of 3 , Oct 24, 2006
    • 0 Attachment
      > //Deleting ofNoUse Objects.
      >
      > for ( int i=nRows-1; i=0; i-- ) // NOTE: Go Reverse.
      > delete []myofNoUse[i];
      > delete []myofNoUse;
      > (cout<<"\nIS myofNoUse deleted? ").flush();
      > }
      > I have two problems in this program. I ran this program in Linux Fedora.
      > Here I am initializing a 2-dimensional array using new. I can see
      > constructor calls and it is happening fine.
      >
      > 1) But while deallocating the array the default destructor is not getting
      > called. Please let me know why ?
      Wrong logic it seems.
      you have i=0 (I think you meant 0 == i)
      Assume nRows = 10 before the loop, then,
      for ( i = 9, 0 == i, i --) {...}
      Won't execute, since i != 0.
      Fix the logic first.

      Regards,
      Om.
    Your message has been successfully submitted and would be delivered to recipients shortly.