[Prev][Next][Index][Thread]

Re: What to do when malloc() returns 0?




>        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 --  eric@spyglass.com 217-355-6000 ext 237
All opinions expressed are mine, and may not be those of my employer.

        Hakuna Patata  (no french fries)