This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL 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: gsl comments


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>



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