April 2006 Archives

Hybrid Cars

| 1 Comment | No TrackBacks
The regular Honda Civic gets 40mpg highway and costs $17,000.
The hybrid Honda Civic gets 50mpg highway and costs $22,000.

At $2.75/gallon for gas, the hybrid costs $0.01375 less per mile. Since the hybrid is $5,000 more, you'll need to drive about 360,000 miles before the hybrid will actually start saving you money.

In the city, the regular Civic gets 30mpg and the hybrid gets 49mpg. This makes the hybrid about $0.03557 cheaper per mile. Even at that rate you still have to drive 140,000 miles before the hybrid starts paying for itself.

Why would anyone buy a hybrid car? Yeah, I guess you're burning less gas, but for $5,000 you can get a nice motorcycle and then _really_ start burning less gas.
Here's something fun I discovered today:


class a {
public:

class b {
public:
virtual void dosomething() = 0;
};
};

class c : public a::b {
public:

class b {
public:
virtual void dosomethingelse() = 0;
};

void dosomething() {}
};

class d : public c::b {
public:

void dosomethingelse() { printf ("do something else\n"); }
void dosomething() { printf ("do something\n"); }
};

void main()
{
d *foo = new d();
c::b *myfoo = reinterpret_cast(foo);
myfoo->dosomethingelse();
}


With Visual Studio .NET 2003 you'll see "do something" on the console. With GCC you'll see "do something else". In fact, with GCC you don't even need the reinterpret_cast.
This is crazy!

A while ago I noticed that the "C/C++" settings block in one of my Visual Studio projects disappeared. I couldn't change any compilation settings in my project unless I made the changes on a per-file basis, which is really annoying when your project has over a hundred files in it, so I just did without. Well today I needed to change something so I set out to correct the problem.

After an hour mucking with the .vcproj file trying to figure out what happened, I finally discovered something: take all .c and .cpp files your project and the "C/C++" settings block disappears. Well, here's what happened: in the studio where I work they don't use .cpp for C++ files, they use .cc.

Add a single .cpp file back to your project and (tada!) you have your C/C++ settings again. *sigh*

Myself

Projects

Monthly Archives

Photos

About this Archive

This page is an archive of entries from April 2006 listed from newest to oldest.

March 2006 is the previous archive.

June 2006 is the next archive.

Find recent content on the main index or look in the archives to find all content.