This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: gsl comments
- From: Gerard Jungman <jungman at lanl dot gov>
- To: Keith Weinman <keith dot weinman at dlr dot de>
- Cc: gsl-discuss at sources dot redhat dot com
- Date: Wed, 23 Mar 2005 12:21:31 -0700
- Subject: Re: gsl comments
- Organization: Los Alamos National Laboratory
- References: <42419C09.2010208@dlr.de>
On Wed, 2005-03-23 at 17:40 +0100, Keith Weinman wrote:
>
> (1) the routines to free memory should check if the pointer
> argument is null - otherwise on some platforms an additional check for
> NULL is required to prevent a segmentation error occuring. While this
> should always be done it would be nice if this check could be hidden
> inside the library.
I agree. The library does two things with memory mangement which
I object to. One is this point about not checking for free(0).
The other is the fact it exposes the allocation and initialization
steps separately, violating the "allocation as initialization" rule,
which I personally consider to be an essential design rule.
C++ codified the the free(0) non-error by stating explicitly
that it is not an error to 'delete' 0, which makes a lot of
sense.
Anyway, gsl is the way it is for two reasons. One is
the "general feeling" (which I don't share), that it should act
as much like libc as possible. The other is that it would be hard
to enforce these higher level design rules on contributed code.
I think we could have done it the right way, but we seem stuck
with what we have now. Brian: any comments?
--
Gerard Jungman <jungman@lanl.gov>