Re: glib strlen ?



On Tue, Mar 25, 2003 at 04:01:24PM -0000, martyn 2 russell bt com wrote:
KISS (Keep It Simple Stupid), 
  whats the point of initializing all kinds of
fancy structures and objects just to manipulate strings ?
string.h is something you can trust; it's _always_ worked.
Merely quoting "KISS" is not an argument by itself that a chosen
implementation is more or less simple. I find accusation that a person
doesn't follow "KISS" to be an insulting statement that really means
"If you don't do it the way I do, a way that I label simple, you must
be stupid."
I think you shouldn't get personal about it.  For all we know you could be
the smartest person on the planet, I would say your response suggests
otherwise.

Why do you make this personal then? Now you question my character for
mentioning that the army of people who yell "KISS" to every problem
insult me? This has nothing to do with me, so why do you fall back to
questioning my motivations or my competence? "Don't get personal - btw,
I think you suck." Sheesh.

You are assuming that strlen() is more simple. In fact, you are
incorrect, because you have not considered that strlen() is but one of
a large family of defficient functions including strcat(), strdup(),
etc.  which can all be easily and *simply* replaced with calls to
g_string_new(), g_string_append(), etc.
What makes them deficient?

I have pointed out a few reasons. For you to ask this question is for you
to suggest that you didn't actually read my previous messages.

Oh, btw, how do you "KISS" g_string_prepend() with string.h?
Who ever mentioned prepending a string? You use the tools for the job, would
you use a hammer to take a door handle off?

Ah yes... :-) The *other* lot of people that I find insulting. Those
who must always compare software tools to hammers and
screwdrivers, and then conclude that their opponent is wrong because they
fail to agree with the analogy.

Because *you* say that (s->len) to GString is as a hammer is to a door
handle, you *must* have a point.

I say that strlen() is a hammer and "char *" is a block of knotted
wood, wheras (s->len) is a hammer+chisel and "GString" is a piece of
quality wood. What say you?

If the original poster is using GString, I challenge you to 
prove to me that:
    strlen(s->str)
Is better or 'simpler' than:
    s->len
Granted, I agree with you that strlen(s->str) _MAY_ be a worse solution to
s->len, but the original user never went into specifics, which is why I
suggested 'strlen' (it is probably more commonly used than gstring is).

The last clause in your paragraph, in the context of GLIB, is the
result of the "KISS" people. The only time s->len is not better than
strlen(s->str) is where typeof(s) != GString*, in which case it isn't
really a GLIB string, but rather a normal z-string. I suppose the
original poster may have not known this, and that his use of "GLIB
string" was incorrect. It is possible.

mark

-- 
mark mielke cc/markm ncf ca/markm nortelnetworks com __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
                       and in the darkness bind them...

                           http://mark.mielke.cc/




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