Sign in to follow this  

for (score and seven; years_ago; ...

This topic is 1531 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My coworker just showed me this piece of beauty he wrote in a project for a client. It's gloriously horrible. And hilarious.
 
#define years_ago (score < 4)
#define and =
#define our_forefathers (score++)
#define seven 0
int score;
 
- (void)setImage:(UIImage *)image
{
    ...
    for (score and seven; years_ago; our_forefathers) {
        GPUImagePicture * stupidlyNamedClassFromALibraryWithNoRegardForDevelopers = [[GPUImagePicture alloc] initWithImage:image];
        ...
    }
}

Share this post


Link to post
Share on other sites

... he wrote in a project for a client ...

#define years_ago (score < 4)
#define and =
#define our_forefathers (score++)
#define seven 0

And when they do a code review, he might discover they are a FORMER client.

It might look cute, but in a professional environment stunts like that can easily mean losing your job.

Share this post


Link to post
Share on other sites

And when they do a code review, he might discover they are a FORMER client.

It might look cute, but in a professional environment stunts like that can easily mean losing your job.

The client is actually a programmer himself and did a code review, and inserted the comments:
 
...
// my favorite #define ever.
#define seven 0
int score;
 
- (void)setImage:(UIImage *)image
{
    ...
    // Friggin awesome.
    for (score and seven; years_ago; our_forefathers) {
        ...
    }
}
So I guess it's all good.

Share this post


Link to post
Share on other sites

Bonus: and is actually a keyword in C++ (inherited from iso646.h then made part of the language), so that macro is effectively changing the language itself. Can't get worse than this.

 

Reminds me of somebody who found long long ago in a file, except of course in that case it was something perfectly acceptable that happened to fit perfectly (long long is a built-in type, and ago is a variable name). No cheating needed there.

Share this post


Link to post
Share on other sites

Bonus: and is actually a keyword in C++ (inherited from iso646.h then made part of the language), so that macro is effectively changing the language itself. Can't get worse than this.

 

Reminds me of somebody who found long long ago in a file, except of course in that case it was something perfectly acceptable that happened to fit perfectly (long long is a built-in type, and ago is a variable name). No cheating needed there.

 

The code is Objective-C so no worries about it being a keyword.  But it is Objective-C which is a coding horror of its own.  I shudder the days I need to work on iOS stuff at work.

Edited by stupid_programmer

Share this post


Link to post
Share on other sites

This topic is 1531 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in to follow this