Google Code Searches

There are some interesting things out there that people are doing with the new Code Search feature that Google released last week. I couldn’t resist coming up with a couple interesting searches of my own.

This first one falls in the “nerdy” category. If you’re familiar with Douglas Adams Hitchhiker’s Guide to the Galaxy series, (as many nerdy programmers are) you’ll get a smile out of this search.

This is one of those hard to find programming errors that tends to bite me in the butt more often than I would like to admit… apparently I’m not the only one.

if (a = b) {/* do something */ }

Just in case you’re not familiar with C/C++ syntax, this should have a ‘==’ instead of the ‘=’. This is a perfectly valid programming statement and the complier does not complain. However the intent is to compare the values, not assign the value of ‘b’ to ‘a’. Some of the results you’ll see in the search are intended to do assignment, but many are obviously not.

Search within C code.

Search within C++ code.

Advertisements
This entry was posted in Programming. Bookmark the permalink.

2 Responses to Google Code Searches

  1. Rob says:

    So I wonder if this bug in the Linux SiS video driver (from the 2.4.33.3 kernel) is fixed yet.

  2. The Ty says:

    Nice. I wonder if in the far flung future they will be recording the past by historians that dig through our code? They will keep coming up with the great answer as “42” and place it into some sort of historical significance. I bit like the ancient cave drawings that make our historians go “Wow, that is a major breakthrough in history!” Yep, a stickman drawing of a guy with a spear and a big goat, must have been significant! 42, the answer of the ages!!! Yes.

    Oh, and J – I finally got my wordpress up and running. Now I just need to find the time to put a few of rambling posts in. Check it out, what do you think?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s