On Wednesday 06 September 2006 06:24, you wrote:
> It is not clear, will this split do something like
> like creating an *argv[] list which has a NULL
> pointer as the last element in the array?
exactly

> Hmmm... is argc guarenteed to be positive? If not,
> what does a negative argc mean? If so, would
> 'size_t *' be a better type for argc?
mh size_t* is a better type for argc.

> Does split() ever return NULL? Or, is it like the
> functions that call error () when there are problems?
can split() signals errors returning NULL and setting argc to 0?

> That is, does this code just core dump with the
> NULL dereference:
>
>     int argc;
>     char **foo = split (NULL, '\0', &argc);
>
> or is errno set and/or error() called?
>
>     char **bar = split ("abcd", ' ', &argc);
>
> Have you considered the desirability of multiple break characters?
> Possibly something like strtok_r semantics to
> break a string into a number of argv tokens based
> on a string of possible break characters
> (e.g., " \t\n\r")
no, but this a very nice idea

Best Regards,
-- Davide Angelocola


Reply via email to