A few months ago, I posted about searching for code. I just learned that Google made an announcement last week about Google Code Search.
I tried it out, but I didn’t find too much more than other code search engines. I was expecting something more, especially in the advanced search section. You can search by license, for instance, but how hard would it be to list compatible licenses, too? For instance, if I look up code under the GPL, wouldn’t it be rather simple to also list similarly licensed code?
I tried looking for a piece of code that I tried to find a few weeks ago. I just wanted to use a Point class to represent a two-dimensional position in space. I figured it would be trivial to write myself, but it would probably be even simpler and less error-prone to find someone else’s well-tested implementation. I actually found that Google’s code search wasn’t returning results as well as other search engines. It was finding all sorts of code that happened to have the word “point” in it.
On the other hand, the engine does support regex, which is really nice. I don’t know how many times I have wanted to search for something with:
#include\ "sd[a-z]*.h"
Typing the above actually shows you the source to SDL_image.h, specifically as part of the framework source for the Weird Worlds demo, interestingly enough. Small world, eh?
And of course, being the vain Internet user I am, I decided to do a search for my name. The search engine actually returned results that included the source to a number of my projects! I guess Google does a really good job of crawling websites.