URL:
<http://savannah.gnu.org/bugs/?49988>
Summary: Allocation of zero-length blocks, vectors, matrices
Project: GNU Scientific Library
Submitted by: roystgnr
Submitted on: Thu 05 Jan 2017 03:54:06 PM GMT
Category: Documentation
Severity: 3 - Normal
Operating System:
Status: None
Assigned to: None
Open/Closed: Open
Release:
Discussion Lock: Any
_______________________________________________________
Details:
In the documentation for allocation functions at
https://www.gnu.org/software/gsl/manual/html_node/Block-allocation.html#Block-allocation
and
https://www.gnu.org/software/gsl/manual/html_node/Vector-allocation.html#Vector-allocation
and
https://www.gnu.org/software/gsl/manual/html_node/Matrix-allocation.html#Matrix-allocation
the gsl_*_alloc() functions are described as intended to "follow the style of
malloc and free", however there is an important distinction in behavior:
malloc handles the "if size is 0" case by returning a NULL or a free()able
pointer value; gsl_*_alloc throws a "block length n must be positive integer"
exception in init_source.c
I would prefer to fix this by adding support for zero-length objects, which
would then obviate the need for special-case code in some of my higher-level
algorithms; however I don't know how intrusive that support would need to be
or whether others would agree with my preference, so I'm marking this as a
"Documentation" bug - a quick resolution would be to simply mention the "n >
0" requirement in the manual.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?49988>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/