Akim Demaille wrote: > > if (!(bla = malloc(n))) > > goto yyexhaustedlab; > > I guess most people just fail here, and don't even try to recover from > memory exhaustion. Out of curiosity: do you really manage to keep > your program working after you've run out of memory?
In my case I'm making a library that people can link with to parse certain data formats. It currently calls abort() if malloc fails, but I thought it should give the caller an opportunity to recover if possible. Don't know all situations where the library might be used, so I prefer to fail gracefully. > I don't think this area (yyexhaustedlab) would change, but you are right > it is an internal detail. I'll add something public in the future, > maybe YYNOMEM. Any idea of a good spelling for such a macro? > YYEXHAUSTED doesn't sound right. Thank you! YYNOMEM sounds good to me. :)