Re: What to do when malloc() returns 0?
Subject: Re: What to do when malloc() returns 0?
From: firstname.lastname@example.org (Eric W. Sink)
Date: Thu, 21 Jul 1994 08:11:11 -0600
> E. Support "malloc failed" return code throughout the library
> - requires significant library reengineering
> - error prone
> - requires library clients to do lots of error checking
> + suitable for use in robust applications
I cast my vote for this. A and B are not robust, and both C and D
also require significant library reengineering. E is clean, can be
done readably, and very portable.
I agree with Phillip too, the library should propagate errors of all
kinds, not just malloc failures.
Eric W. Sink, Software Engineer -- email@example.com 217-355-6000 ext 237
All opinions expressed are mine, and may not be those of my employer.
Hakuna Patata (no french fries)