View Single Post
Old 02-17-07, 04:36 AM   #67
Nerd, Geek, Freak
wnd's Avatar
Join Date: Sep 2005
Location: Finland
Posts: 703
Default Re: Languages you know

Originally Posted by evilghost
It's fairly easy to find someone who doesn't know what they're doing.
Reminds me of the following piece of code:
int i;
for (i = 0; i < g_list_length(list); i++) {
    struct whatever_data *data;
    data = (struct whatever_data *) g_list_nth_data(list, i);
Someone clearly didn't know you can iterate through the list using linked_list->next (or by calling g_list_foreach(), but that would require a callback function). Although the list always had less than 80 elements, he would still use O(n^2) time instead of O(n). I hardly think GLib would have any internal indexing for GList. At least he didn't manually iterate to the n:th element inside the outer loop...
web | cat

Christianity, noun: The belief that a cosmic Jewish Zombie who was his own father can make you live forever if you symbolically eat his flesh and telepathically tell him you accept him as your master, so he can remove an evil force from your soul that is present in humanity because a rib-woman was convinced by a talking snake to eat from a magical tree. [mad.frog]

Last edited by wnd; 02-17-07 at 04:37 AM. Reason: Better quote
wnd is offline   Reply With Quote