This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
[Help Request]: GSL_RANGE_CHECK_OFF ?
- From: Raimondo Giammanco <rongten at member dot fsf dot org>
- To: gsl-discuss at sources dot redhat dot com
- Cc: rongten at member dot fsf dot org
- Date: Wed, 02 Jun 2004 11:38:00 +0200
- Subject: [Help Request]: GSL_RANGE_CHECK_OFF ?
Hello,
I am currently developing a small code using gsl, and was doing some
tests about the range checking, finding a strange behavior.
I admit I am not using C from long time so it is possible that I am
asking a stupid question, in this case I apologize in advance.
I have gsl 1.4 compiled on a Gentoo Base System version 1.4.10,
with gcc version 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7)
and glibc 2.3.2 on kernel 2.4.26.
According to the documentation, if I compile a program with
-DGSL_RANGE_CHECK_OFF, I should jump the range checking with
hopefully beneficial effects on performance.
However, when I run a program with an out of bound access,
the program, compiled with or without this macro declaration
gives me always the same error :
gsl: vector_source.c:29: ERROR: index out of range
Default GSL error handler invoked.
Aborted
Now, in /usr/include/gsl there is no mention GSL_RANGE_CHECK_OFF, only
of GSL_RANGE_CHECK. Looking in the tar archive, I do find a mention
to GSL_RANGE_CHECK_OFF, but this recalls GSL_RANGE_CHECK.. I do not
really understand.
So the question is, I am doing some mistake without realizing it , or I
have an installation that somehow is broken? I have looked to the
install script and it does not do anything fancy, in other words
it uses mostly the default settings.
On a side note, since the index is a size_t, the checking is performed
only to see if the requested index is bigger than the admissible value.
What happens if at runtime to requested index is assigned a negative
number? It is promoted to unsigned and therefore automatically is a
very big number? I know I should look elsewhere for this answer, but
since this question is somehow linked to the main topic..
Thanks in advance.
Raimondo Giammanco
--
Raimondo Giammanco <rongten@member.fsf.org>