public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* [Help Request]: GSL_RANGE_CHECK_OFF ?
@ 2004-06-02 10:08 Raimondo Giammanco
  2004-06-02 11:23 ` Brian Gough
  0 siblings, 1 reply; 6+ messages in thread
From: Raimondo Giammanco @ 2004-06-02 10:08 UTC (permalink / raw)
  To: gsl-discuss; +Cc: rongten

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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-06-04 16:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-02 10:08 [Help Request]: GSL_RANGE_CHECK_OFF ? Raimondo Giammanco
2004-06-02 11:23 ` Brian Gough
2004-06-02 14:38   ` Raimondo Giammanco
2004-06-02 15:23     ` Brian Gough
2004-06-04 12:53       ` Raimondo Giammanco
2004-06-04 16:08         ` Brian Gough

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).