RE: glib strlen ?



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.

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?


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?

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

Regards,
Martyn  



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