[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [BusyBox 0001076]: "ip addr del" does not work
From: "Robert P. J. Day" <rpjday () mindspring ! com>
Date: 2006-10-26 22:24:40
Message-ID: Pine.LNX.4.64.0610261822540.28806 () localhost ! localdomain
[Download RAW message or body]
On Thu, 26 Oct 2006, Denis Vlasenko wrote:
> On Thursday 26 October 2006 21:40, Robert P. J. Day wrote:
> > > > int compare_string_array(const char * const string_array[], const char *key)
> > > > {
> > > > return compare_string_array_internal(string_array, key, 1);
> > > > }
> > >
> > > compare_string_array({"aaa","bbb","ccc"}, "b") returns 1 -- ??!
> > >
> > > > int compare_substring_array(const char * const string_array[], const char *key)
> > >
> > > Name of this one doesn't immediately say what it is doing.
> > > I have hard time imagining a "substring array" at all...
> > >
> > > compare_string_array() is also can have better name.
> > > find_in_string_array()?
> >
> > there's a recommended rule that functions be given names so that, when
> > used in their natural context, they make intuitive sense. for
> > instance,
> >
> > if (compare_string_array(...)) {
> >
> > doesn't really suggest what's being returned, but
> >
> > if (string_array_contains_string(...)) {
> >
> > should be immediately obvious. or something like that.
>
> compare_string_array() returns index of string, not just 1/0.
> index_in_str_array()?
much better. i didn't read closely enough as to what the function was
supposed to do, my fault.
for the most part, functions should avoid uninformative prefixes like
"compare", "check" or "validate".
rday
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic