guile-user
[Top][All Lists]
Advanced

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

Re: SRFI-4's `scm_take_TAGvector ()'


From: Ken Raeburn
Subject: Re: SRFI-4's `scm_take_TAGvector ()'
Date: Wed, 17 Aug 2005 12:47:22 -0400

On Aug 17, 2005, at 10:16, Ludovic Courtès wrote:
While the name of the `scm_take_TAGvector ()' function is pretty good at
suggesting that it will take control over the data pointed to by the
first argument, I find the prototype of these functions quite
misleading.  IMO, instead of:

  SCM scm_take_u8vector (const scm_t_uint8 *data, size_t len);

this should be:

  SCM scm_take_u8vector (scm_t_uint8 *data, size_t len);

Removing the `const' qualifier provides additional semantic information to the compiler that could help detect misuses of these functions. For
example, a warning would be issued for a call like:

  scm_take_u8vector ("hello", 6);

... except for the little detail that ISO C says a string literal has type "char [N]", not "const char [N]". So, probably no warning in this case.



reply via email to

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