Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Coffee corner » Strange program crash
Re: Strange program crash [message #39177 is a reply to message #39176] Sat, 23 February 2013 05:06 Go to previous messageGo to previous message
Lance is currently offline  Lance
Messages: 527
Registered: March 2007
Contributor
code in c
struct node *RowHeader[MAX_ROW];


more likely translates to

typedef struct node Node;
// actually, in C you need the struct, in
// c++, it can be opted out
// so
// typedef node Node; 
// is the same
 Vector<Node*> RootHeader;


However, you may want to put the dynamically allocated node* into some smart pointer so that they will be delete'd (free'd).

or you can do it yourself


class MyNodeContainer : public Vector<node*>
{
public: 
     ~MyNodeContainer()
     {
           for(int i=0; i<GetCount(); ++i)
               delete (*this)[i];
               // or free((*this)[i]); if the nodes are malloc'ed
      }
      and other method, eg, constructors,..
}

[Updated on: Sat, 23 February 2013 05:29]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: MSVC and code size
Next Topic: NaCl office
Goto Forum:
  


Current Time: Mon Apr 29 03:15:42 CEST 2024

Total time taken to generate the page: 4.92374 seconds