guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C level variants of make-vector / make-string


From: Dirk Herrmann
Subject: C level variants of make-vector / make-string
Date: Thu, 8 Feb 2001 12:52:07 +0100 (MET)

Hello everybody!

We currently have the following C level variants of make-vector:

scm_make_vector:
  Full type and range checking.
scm_c_make_vector:
  Takes the size parameter as an unsigned long int.  Checks if size is
  smaller than SCM_VECTOR_MAX_LENGTH.  Further, a size of zero has to be
  treated specially.

For make-string:

scm_make_string:
  Full type and range checking.
scm_makstr:
  Takes the size paramter as a signed long int.  Checks if size is smaller
  than SCM_STRING_MAX_LENGTH but does not check if size is > 0.

First, I suggest to introduce scm_c_make_string to replace scm_makstr
(which would be deprecated).  The function scm_c_make_string would take
the size argument as an unsigned long int or scm_sizet.

Now, there are lots of places within guile where even the remaining checks
of scm_c_make_vector and scm_makstr are unnecessary, because they are
called with constants that are known to fit into the required
ranges.  Thus, it could make sense to have a _third_ variant of these
functions which do not perform any range checking at all.  But:  How
should these be named?  scm_c_* is already used.

Best regards,
Dirk Herrmann




reply via email to

[Prev in Thread] Current Thread [Next in Thread]