unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* SRFI-4's `scm_take_TAGvector ()'
@ 2005-08-17 14:16 Ludovic Courtès
  2005-08-17 16:47 ` Ken Raeburn
  2005-12-06 21:17 ` Marius Vollmer
  0 siblings, 2 replies; 4+ messages in thread
From: Ludovic Courtès @ 2005-08-17 14:16 UTC (permalink / raw)


Hi,

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);

What do you think?

Thanks,
Ludovic.


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: SRFI-4's `scm_take_TAGvector ()'
  2005-08-17 14:16 SRFI-4's `scm_take_TAGvector ()' Ludovic Courtès
@ 2005-08-17 16:47 ` Ken Raeburn
  2005-08-18  7:53   ` Ludovic Courtès
  2005-12-06 21:17 ` Marius Vollmer
  1 sibling, 1 reply; 4+ messages in thread
From: Ken Raeburn @ 2005-08-17 16:47 UTC (permalink / raw)
  Cc: guile-user

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.

_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: SRFI-4's `scm_take_TAGvector ()'
  2005-08-17 16:47 ` Ken Raeburn
@ 2005-08-18  7:53   ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2005-08-18  7:53 UTC (permalink / raw)
  Cc: guile-user

Ken Raeburn <raeburn@gnu.org> writes:

> ... 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.

Indeed!  One never stops learning C...  ;-)

Still removing `const' makes sense in the general case, don't you think
so?

Thanks,
Ludovic.


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

* Re: SRFI-4's `scm_take_TAGvector ()'
  2005-08-17 14:16 SRFI-4's `scm_take_TAGvector ()' Ludovic Courtès
  2005-08-17 16:47 ` Ken Raeburn
@ 2005-12-06 21:17 ` Marius Vollmer
  1 sibling, 0 replies; 4+ messages in thread
From: Marius Vollmer @ 2005-12-06 21:17 UTC (permalink / raw)
  Cc: guile-user

ludovic.courtes@laas.fr (Ludovic Courtès) writes:

> Hi,
>
> 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);
>
> What do you think?

I agree.  I made that change.

(Slowly working towards your other patches now... hang in there...)

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


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

end of thread, other threads:[~2005-12-06 21:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-17 14:16 SRFI-4's `scm_take_TAGvector ()' Ludovic Courtès
2005-08-17 16:47 ` Ken Raeburn
2005-08-18  7:53   ` Ludovic Courtès
2005-12-06 21:17 ` Marius Vollmer

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).