Posts tagged ‘work’

C++ is bad: problems with the ternary operator

In today’s installment of “why not to program in C++,” I give you the following quiz, which Dustin, Steve, Tom, and I had to figure out today (Dustin’s code was doing the weirdest things, and we eventually traced it down to this):

Suppose you start out with the following code:

class Argument;
Argument x;
void Foo(const Argument& arg);
bool test;

You can assume that all of these are defined/initialized elsewhere in the code. For each pair of code snippets below, decide whether the two snippets are equivalent to each other.

# Code Snippet
Code Snippet
if (test) Foo(x);
else Foo(Argument());
Foo(test ? x : Argument());
{ // limit the scope of y
  Argument y;
  Foo(test ? x : y);
Foo(test ? x : Argument());
Foo(test ? x : x);
Foo(true ? x : Argument());

Edit: what I meant by the curly braces in Question 2 is that you shouldn’t consider “y is now a defined variable” to be a significant difference between the two snippets.

The answers are worse than you'd think. →


Hells yeah! The Internet Corporation for Assigned Names and Numbers, the group in charge of domain registrars (who are in charge of keeping track of who owns what domain names) changed some boring policies, and my personal work indirectly affected the entire Internet. →

Protected: More info about my job

This content is password protected. To view it please enter your password below:


I’m now up in northern California for a week of orientation before I start my real job. The hotel I’m in is amazingly swanky—in my room I have a Rubik’s Cube, a deck of cards, a yoyo, and an etch-a-sketch, not to mention a bowl of cherries, a couch, and some other fancy stuff. The main office here really is as amazing as most of the stories make it seem. I unfortunately am not allowed say much of anything about what I’ll be doing or what it’s like to be in the company, what with their culture of secrecy and all. My first day wasn’t exactly like the way dhalps got his security clearance for his internship in Washington, but it was similar enough to conjure up a comparison. Suffice it to say, there’s a lot of new and exciting stuff for me to learn, but unless something really unusual happens, I’m not going to comment about work much more here. Sorry!

Seymour’s my friend

Someone show me a way to get outa here,
‘Cause I constantly pray I’ll get outa here
Please, won’t somebody say I’ll get outa here
Someone gimme my shot or I’ll rot here.

I’ll do I dunno what to get outa [Mudd]
But a hell of a lot to get outa [Mudd]
People tell me there’s not a way outa [Mudd]
But believe me I gotta get outa [Mudd now!]

I’m pulling my third all-nighter of the week (well, not quite – I’ve gotten at least an hour of sleep every day), and I don’t expect to have less work until Wednesday afternoon, when I will only have a 15-minute presentation and a 20-page paper left to do. I am so ready to graduate right now!

However, the Big Algorithms presentation on Tuesday went just about perfectly (Reid and I discussed pattern matching, and in particular the Knuth-Morris-Pratt and Boyer-Moore algorithms): people seemed to understand everything we covered, we answered questions well, and they asked leading questions (this was awesome – on 3 separate occasions, we answered questions with “actually, that’s covered on the next slide…”). Our timing was perfect down to about 2 minutes of the 75-minute lecture, which blew me away because we’d never actually practiced the entire thing before. Moreover, Reid (who has a speech impediment where he stops talking when he gets flustered) went through his half perfectly, without any long pauses. On the feedback forms, one person even wrote that this was the best student lecture of the entire class. \/\/00T!

Right. Back to work…

A good day, for a change

As many of you probably know, I feel quite overwhelmed with work right about now. Today changed all of that. I was supposed to have a test in my BritLit class this morning, but I spent more time sleeping due to exhaustion last night than I had intended, and therefore less time studying. This morning rolls around and I hoped to just wing it. You know what? The test proctor never showed up, so after 20 minutes we all just wrote down the 14 lines of poetry we had to memorize, put them in a big pile, and left. How great is that!? The rest of the test has been rescheduled for Monday. Then, this afternoon in my Issues of Clinic class, the entire class was given an extension on our final papers until Monday morning. So all that’s left for this week is clinic and SciComp, which can easily fill up the rest of the week but is totally doable. O frabjous day!

Right. I’m gonna go take a nap.

Protected: I can do it!

This content is password protected. To view it please enter your password below:


If you have time and inclination, I invite you all to come see the LaTeX talk today (Friday) at 4:15 in Galileo Edwards. I made the slides, with a bit of editing from Mac, and I’m currently making the handout. I don’t yet know if I’m giving the talk, but I suspect I am.

After that, I invite you all to come see the robotics talk I’m giving along with Mac, Ricco, and Ben on Saturday. We’re giving it at 4:30 in Galileo Edwards. This talk has the potential to be awesome or horrible, depending on how smoothly things go tomorrow: we have to build the robot, find computers to run it (we still have the software, but we need 2 laptops with Visual Studio and OpenCV, as well as two of the webcams in the lab) and rehearse our talk (we haven’t given it since about September). Still, it should be fun. It was a really great project with some really great results. And we might even do a demonstration!

I now have to go start the handout for the talk in my psych class to which you’re not invited… :-P

This Semester was Supposed to Be Easier…

Well, crap. Tomorrow I have a clinic presentation, and tonight I have a practice for that. Tomorrow I also have SciComp due (and no, I did not turn in the rough draft when it was due last week, so I have a fair amount left) and Big Algorithms. Wednesday I have a paper due in my Brit Lit course, followed by more Big Algorithms on Thursday. Friday, for a change, I have a presentation as well as a project proposal for my Psych course and I think that this week I’m supposed to make the slides for the LaTeX seminar. and to top it off, Letty wants the robotics team to give a presentation for Parents Weekend (I still haven’t seen the robot since August, let alone checked if it still works, let alone created a map of… wherever the presentation is going to be). Moreover, I got about 3 hours of sleep last night. I was given to understand that this semester’s 18 credits would be easier than my equivalent of 22 credits last semester, but that’s not happening right now. Only 3 more months to go… :-P