?

Log in

No account? Create an account
color cycle (slow)

Kistaro Windrider, Reptillian Situation Assessor

Unfortunately, I Really Am That Nerdy

Previous Entry Share Next Entry
Sorry about the silence
nyah, tongueout, glasses, nerd
kistaro
Apologies for my lack of posting of late. My classes have gotten the best of me, and I just haven't had much time- when I have had free time, I've been prioritizing it differently, and making my own LiveJournal posts is not a high priority for me! Although I do have stuff I want to post about- I just haven't gotten around to it. I'll probably write something up over the weekend!

In the meantime: Google has released a new tool- Code Search. It's Google search, but over source code. It's convenient! Of course, the first comment on the Slashdot story about it has a link to search for the word "fuck" in it. I highly recommend this activity. Programmers can appreciate the code and laugh at the shared frustration, knowing the moods that encourage one to write code (comments and variable names both!) in such a way. And non-programmers can appreciate the humor as well...


  • 1
This is not easy to write but.. *tries keeping it in check*


There's no fuck in my code, as I usually don't swear; but there's this!

Source/fractal_reimplementation/escape_time/animat/etime.cc: // what a kludge. Fix later
Source/km/atomic_decompiler/simple_combination/analyze_atom.cc: value[0] = 3; // Kludge or reality?
Source/km/evenmorega/backup_0p157/mars.cc:// Yucky Kludge Ahoy!
Source/km/evenmorega/backup_0p157/population.cc:// Too lazy to move Bijective to its own class.
Source/km/from_wabox/a-c/defender.cc:// if anything is hack-mode generated, this is it.
Source/km/push-slide/expan2/psp.cc:// Yes. Yucky. I'm too lazy to do proper C++.
Source/km/various_fractal/sa/h6d.cc: Coordinate * kludge = new Coordinate[xyzzy];
Source/km/consgroup/bak.manual_sort.cc: global_hack++;
Source/lapca_test/ipca_test/bak.ipca.cc: // Huge ass kludge with selection sort x2
Source/vector_quant/reproduce/fftw_poc.cc:// Only slightly better than the enormous kludge we had up in optimize, but
ource/vector_quant/reproduce/colorii/splitkmeans.cc:// Hack hack hack
Source/vector_quant/reproduce/colorii/splitkmeans.cc: // ugly hack)

You'd probably appreciate this one more- all the GPLed C++/C code that Google knows about in which an "if" statement is terminated by a semicolon on the same line. It's correct in about half the cases, but the other half have some worrying indentation, and one case was followed with curly brackets.

Wouldn't that do nothing?

Oh, I see, it's where someone disabled the if because they want it to trigger all the time.. correct?

It would be an unconditional conditional, and that is a condition I suspect is evidence of a very probable bug in a program- especially when other people are expected to be able to read the code (it's GPLed) and the next line is indented in such a way that it looks like a regular if statement!

Whenever I have some reason to produce an empty "if" statement (I don't think I ever have) or, more commonly, an empty while or for loop, it looks something like
for(variable=initializer;condition(variable);++variable)
    ;

which is, to me, largely unambiguous and less immediately confusing than {}, given that my brace style puts the { on the same line as the control statement that spawned the block.

Hm, the "condition no longer required" hypothesis would seem to make sense, though. Say you start off with
if (something) {
   branch
} else {
   handle
}

and you eventually expand the branch into handling everything, and then
if (something) {
  branch
}

and finally you find out there's no need for the if anymore, but you're too lazy to indent the code back,
 if (something) ;
  branch

Though I don't see why one wouldn't dispense of the if (something); while doing the cleanup that removed the handling under else.


I also see some kinda odd ways to do an if in the segments that are shown - like if (something); else { real code } instead of if (!something) { real code }. And someone's trying to emulate a switch-case with ifs (too lazy to type break; after each? Nah, the if sentence is longer), using if (blah); in case he'll need that particular case in the future.

*Somebody* had to say it.

Fucking awesome!

  • 1