Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    198
  • comments
    445
  • views
    83449

## Spot the WTF

Sign in to follow this  
Laz

108 views

So i've run into a few WTFs in the code for my Lazteroids game. Below are the two biggest and most problem causing WTFs I've come across in my code. So, for your viewing plasure, here you go. Spot the WTF!

WTF #1:
Quote:
void Matrix4f::SetX(Vec3f *vec)
{
matrix[0] = vec->x;
matrix[1] = vec->x;
matrix[2] = vec->x;
}

void Matrix4f::SetY(Vec3f *vec)
{
matrix[4] = vec->x;
matrix[5] = vec->x;
matrix[6] = vec->x;
}

void Matrix4f::SetZ(Vec3f *vec)
{
matrix[8] = vec->x;
matrix[9] = vec->x;
matrix[10] = vec->x;
}


Note: Apparently .cpp doesn't mean "C plus plus" ... it means "Copy and Paste Programming" ...

And, WTF #2:
Quote:
Vec3f &Vec3f::operator-(Vec3f &vec)
{
Vec3f _vec;

_vec.x = x - vec.x;
_vec.y = y - vec.y;
_vec.z = z - vec.z;

return vec;
}


And there we have it. Proof that I'm an idiot :)
Sign in to follow this  


3 Comments


Recommended Comments

Quote:
Apparently .cpp doesn't mean "C plus plus" ... it means "Copy and Paste Programming"

[lol] I like it.

I've lost count of how many times I've shot myself in the foot copy-n-pasting while programming.

Almost think it'd be a neat feature of any IDE - forcefully block CTRL+C, CTRL+X and CTRL+V [smile]

Share this comment


Link to comment
Be careful with that second one... you don't want to be returning a reference to an object that is about to disappear from the stack.

Share this comment


Link to comment
Quote:

Quote:

Apparently .cpp doesn't mean "C plus plus" ... it means "Copy and Paste Programming"

I like it.

Haha me too [smile] I'll have to remember that one

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!