This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: limit for # of items created with "new" ?


> From: Emil Briggs [mailto:emil@baymountain.com]
> 
> On Tuesday 24 September 2002 10:28 pm, Ross Smith wrote:
> > From: Hans Horn [mailto:hannes@2horns.com]
> >
> > > // an element of a linked list
> > > typedef struct node {
> > >   node (int _v, node* _n) : v(_v), next(_n) {}
> > >   int   v;
> > >   node* next;
> > > };
> >
> > I'm surprised that compiled; the typedef shouldn't be there.
> >
> > > int main (int argc, char** argv) {
> > >   // allocate descriptions of points
> > >   char** points = new char*[NUM_POINTS]; assert(points);
> >
> > The assert is superfluous; new is guaranteed never to return null.
> >
> 
> Except when you are out of memory.

No. It throws a std::bad_alloc exception.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]