« Oh, Snap! | Main | This One's for Bo »

November 18, 2006

Fuck You, C++

At the moment, lines 70-73 of my Netflix code look like this:

  
while(true){
    numcls = (rand()%40)+10;
    cout << "Number of clusters: " << numcls << endl;
    kmeans(numcls, usercount, (maxmov-minmov)+1);
}

If I compile and run my code, I get a segmentation fault in a method called at line 60. However, if I comment out the while loop at line 70 -- so that K-Means runs, but only once -- everything works fine and a I actually get decent results.

This would never happen in a real programming language.

(By 'this' I mean both the inexplicable crashing and the good results -- the code would be too slow to get any results.)

Posted by todd at November 18, 2006 10:16 AM

Comments

Update: Apparently, I can also just change the while(true) loop to a for(int i=0; i>-1;) loop, and that segfault is avoided. Fucking ridiculous.

Posted by: todd. at November 18, 2006 10:22 AM

Post a comment

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?