Comment On Coded Smorgasbord: Prepare For Return

For more fun-but-not-necessarily-bad code, check out the previous episode: Coded Smorgasboard: Muhahahahaha [expand full text]
« PrevPage 1 | Page 2Next »

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 12:46 • by hoens
The real WTF is the tripple post....

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 12:59 • by EV

I competed in NWERC last sunday... See: http://www.csc.kth.se/contest/nwerc/2006/

The judge's solutions were posted today... I saw the following line in the code:

int INF=99999999 

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 13:16 • by m0ffx
103470 in reply to 103467
Defining infinity as a large but finite number is possibly the least wtfey thing there. It seems quite reasonable that you might be modelling some situtation where once a value gets large enough, it might as well be infinite, or that you might want to approximate an infinite process, e.g. a series summation or an iteration, by a finite one.

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 13:24 • by Igor
Nikita Zhuk is definitely a "he", not "she"

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 13:41 • by Rob G!

I would have opted for "DrStrangelove", but I guess "DickBagMcButtMunch" works too..... But I can't even imagine writing DickBagMcButtMunch in code, Even though I consider myself creative......

rob

Captcha = random,  as in this programmer

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 13:44 • by RogerC
103473 in reply to 103470

m0ffx:
Defining infinity as a large but finite number is possibly the least wtfey thing there. It seems quite reasonable that you might be modelling some situtation where once a value gets large enough, it might as well be infinite, or that you might want to approximate an infinite process, e.g. a series summation or an iteration, by a finite one.

Exactly right. The SCPI standard (Standard Commands for Programmable Instruments) used in the test and measurement industry defines infinity as 9.9E37. To quote the standard:

The numeric values for positive and negative infinity were chosen so that they fit into a 32-bit IEEE 754 floating point number. This allows easy implementation using standard tools in all popular languages and operating systems. Note that this does not limit the numeric resolution. These values are larger than any quantities used or anticipated in instruments.
 

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 13:47 • by Vagary

I know absolutely no Chinese, but my research says:

So the function translates to:

/*Added by Jiang W */
void compute(int hello)
{
int temp = 0;
// temp = 3 /*erase by Li K */
temp = 3;
return;
}

Obviously just testing out the language - a HelloWorld sort of thing.

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 13:53 • by An apprentice
Alex Papadimoulis:

if (Math.max(1, 2) == 2) return;

Don't ever trust your libraries. Common paranoia or defensive programming taken to the extreme?


Re: Coded Smorgasbord: Prepare For Return

2006-11-24 14:30 • by iwpg
103479 in reply to 103473
Alex Papadimoulis:

Oscar
found this during a recent, and apparently much needed, clean up of the
codebase for an application. Good for when the number line reverses
itself I suppose?

if (Math.max(1, 2) == 2) return; 

[snip] 

I guess in Ryan Patterson's company, use of equipment changes the basic laws of mathematics?

IF 0 > 0
BEGIN
SELECT 'Equipment is in use'
RETURN
END

Maybe both of those were slightly "creative" ways to "temporarily" comment out the block/rest of the function?  Perhaps the JavaScript one already had /* */ comments, so the programmer couldn't have used those (since they don't nest), and maybe that SQL dialect didn't have block comments at all - and both programmers were too lazy to figure out how to make their editors add end-of-line comments to each line (that's not much of an excuse with the SQL one, since it's so short, but that's hardly the worst thing that's ever been on this site).

RogerC:

Exactly right. The SCPI standard (Standard Commands for Programmable Instruments) used in the test and measurement industry defines infinity as 9.9E37. To quote the standard:

The numeric values for positive and negative infinity were chosen so that they fit into a 32-bit IEEE 754 floating point number. This allows easy implementation using standard tools in all popular languages and operating systems. Note that this does not limit the numeric resolution. These values are larger than any quantities used or anticipated in instruments.

 

In that case, the Real WTF is that they didn't use the infinities built into IEEE 754 in the first place.... (Well, OK, maybe they wanted to support systems that don't implement the full IEEE spec.) 

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 14:33 • by Dazed
103480 in reply to 103471
Anonymous:
Nikita Zhuk is definitely a "he", not "she"


Based on what? That you are Nikita Zhuk? I know two Nikitas and they are both female.

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 14:46 • by jer
103481 in reply to 103467
Anonymous:

I competed in NWERC last sunday... See: http://www.csc.kth.se/contest/nwerc/2006/

The judge's solutions were posted today... I saw the following line in the code:

int INF=99999999 



How would you quantify an infinite value in a finite system? The best you can do is approximate it.

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 14:47 • by Huggie
Alex Papadimoulis:
private static final Logger logger 
= Logger.getLogger("DickBagMcButtMunch");

Ehl. Oh. Ehl. 

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 14:49 • by yazow
Alex Papadimoulis:

From A, I guess this just gives a whole new meaning to "Infinity Plus One" ...

#define INFINITE	10000

 

Not a WTF at all. Let say you are writing a simple router or something, you need some value that is agreed as "infinite" that can be counted up to for the max delay (that is smaller than the max of whatever data type you are using). Without the rest of the code it's hard to say it is a wtf when it is out of context. The one after baffles me though.. I can't think of a single time when I'd want ZERO to be -1.

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 15:10 • by mgsloan
Alex Papadimoulis:

I used above ASP.NET code. Problem is in " Rnd() "
Rnd() value is changing everytime.

What is the alternative for Rnd()?
OR How will stop Rnd() value changes at everytime? 

 

Perhaps they actually have a greater understanding, having prematurely grasped the concept of purely functional code?

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 15:18 • by Michael Buschbeck
103486 in reply to 103479
iwpg:
Alex Papadimoulis:

Oscar found this during a recent, and apparently much needed, clean up of the codebase for an application. Good for when the number line reverses itself I suppose?

if (Math.max(1, 2) == 2) return;

Maybe both of those were slightly "creative" ways to "temporarily" comment out the block/rest of the function?  Perhaps the JavaScript one already had /* */ comments, so the programmer couldn't have used those (since they don't nest), and maybe that SQL dialect didn't have block comments at all - and both programmers were too lazy to figure out how to make their editors add end-of-line comments to each line (that's not much of an excuse with the SQL one, since it's so short, but that's hardly the worst thing that's ever been on this site).

Java, I'd say, not JavaScript; and the WTF-est part of it is probably the circuitous way of writing "true."

I occasionally find myself adding "if (true) return;" to Java code I'm debugging in order to shortcut over the remainder of the method. In most other languages, I'd just write the equivalent of "return;", but Java, being its tiresome self, knows better than to let me have unreachable code in a method body without throwing a fatal compilation error.

Not that Sun's "javac" would be clever enough to recognize that "if (true)" is, in effect, an unconditional branch, too. Hmm, maybe the original author of the quoted code did have a smarter "javac" implementation than Sun's... but then, debug code like this getting into production is just as much a WTF.

(First post here.  I almost daren't press "Post" lest the "hotdog" in the captcha eat my formatting.)

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 15:20 • by Arancaytar

From the Jan-Feb 1982 of Computer Gaming World (as discovered by Jaliya Jayawardena), here's how we used to patch games before that whole Internet thing was around ...

From the days of yore, when readers of gaming magazines were usually able to code...

That said, just last weekend I came across a cheap accounting tool that, in the print-out for the installation procedure, explained what to change a certain line of install.bat to, since they'd made a typo in one of the batch commands.

In both cases, the one-line fix didn't merit the cost for distributing a new version. Thank goodness for the internet...

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 15:22 • by reinis
103488 in reply to 103480

Anonymous:
Based on what? That you are Nikita Zhuk? I know two Nikitas and they are both female.

 ??? is a Russian surname, and ?????? is a male name in Russia.

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 15:24 • by reinis
103489 in reply to 103488

reinis:
??? is a Russian surname, and ?????? is a male name in Russia.

So, in Russia it's not a unisex name.

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 15:26 • by Kenton

if (Math.max(1, 2) == 2) return;

This was probably intended as an alternative to commenting out the rest of the method.  Java normally refuses to compile code that has blocks which can never be reached, so "return;", "if (true) return;", and even "if (0 == 0) return;" would not have worked.  You have to trick the compiler into thinking that it might be possible to skip the return.  You might want to do this if the code below couldn't be commented because it had /* */ comments in it already, or if you wanted the compiler to continue to typecheck the code even though it was not being used.

Of course, code like this should never be checked in to source control; just used for temporary testing. 

Captcha:  wtf
 

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 16:00 • by Jackal von ÖRF
103492 in reply to 103490
Anonymous:

if (Math.max(1, 2) == 2) return;

This was probably intended as an alternative to commenting out the rest of the method.  Java normally refuses to compile code that has blocks which can never be reached, so "return;", "if (true) return;", and even "if (0 == 0) return;" would not have worked. 

Using "if (true) return;" is possible in Java (I use it sometimes myself) because the compiler does not check for constant expressions. However, my Java IDE's (IntelliJ IDEA) code inspections do give a warning about it, the same they do for "1 + 2 == 3" etc., so maybe the writer of that code wanted to avoid the warning by using an overly complicated expression.

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 16:23 • by Vasilij
103494 in reply to 103489
Anonymous:

reinis:
??? is a Russian surname, and ?????? is a male name in Russia.

So, in Russia it's not a unisex name.


Nope. Even if it was, the last name would be a giveaway, the female form of last names (except for foreign, i.e. Jewish) always ends in -a. So in this case, ???? or more likely ??????.

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 16:28 • by iwpg
103495 in reply to 103486

Michael Buschbeck:
Java, I'd say, not JavaScript


Yeah, could well be, good point.


Michael Buschbeck:


Not that Sun's "javac" would be clever enough to recognize that "if (true)" is, in effect, an unconditional branch, too. Hmm, maybe the original author of the quoted code did have a smarter "javac" implementation than Sun's... but then, debug code like this getting into production is just as much a WTF.


That's deliberately allowed, since "if (constant_expression)" the Java way of doing conditional compilation.  On the other hand, it does seem a bit silly to allow literal true or false, once you've decided to be picky about unreachable code, since the point would be to use static final variables so you can change them more easily.  On the other other hand, adding special cases like that would just make the language more complicated.

On the subject of smarter Java compilers: the exact reachability rules are defined in the language spec, to preserve the portability of the code - if it works in one implementation, it's supposed to work in any other, at compile time as well as runtime.


Re: Coded Smorgasbord: Prepare For Return

2006-11-24 16:57 • by Olddog
103498 in reply to 103481
Anonymous:
Anonymous:

I competed in NWERC last sunday... See: http://www.csc.kth.se/contest/nwerc/2006/

The judge's solutions were posted today... I saw the following line in the code:

int INF=99999999 

How would you quantify an infinite value in a finite system? The best you can do is approximate it.

How would you quantify zero in a finite system? Assuming there's always two halves of any finite value

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 17:17 • by PlasmaHH
Alex Papadimoulis:

From the Jan-Feb 1982 of Computer Gaming World (as discovered by Jaliya Jayawardena), here's how we used to patch games before that whole Internet thing was around ...



Full Size: http://img.thedailywtf.com/images/200611/1982_0102_issue2.gif

I cannot find much of a wtf here. Maybe it should better say IF RG<1 THEN RG=1. Really, preventing div by zero is so often done in a "lets use the smallest value near to 0 that makes sense" way, that even if it is wrong to do so (often enough its not) is not a wtf anymore.

But some of the others taught me to not drink while reading this site. Anyone knows how to get coke out of a laptops tft and keyboard?

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 18:38 • by Element
103501 in reply to 103494
Anonymous:
Anonymous:

reinis:
??? is a Russian surname, and ?????? is a male name in Russia.

So, in Russia it's not a unisex name.


Nope. Even if it was, the last name would be a giveaway, the female form of last names (except for foreign, i.e. Jewish) always ends in -a. So in this case, ???? or more likely ??????.

 Not necessarily. Zhuk is also an Indian last name. Nikita Zhuk is a very likely name for a female from India =)
 

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 18:58 • by Solarcanine
103502 in reply to 103501
Anonymous:
Anonymous:
Anonymous:

reinis:
??? is a Russian surname, and ?????? is a male name in Russia.

So, in Russia it's not a unisex name.


Nope. Even if it was, the last name would be a giveaway, the female form of last names (except for foreign, i.e. Jewish) always ends in -a. So in this case, ???? or more likely ??????.

 Not necessarily. Zhuk is also an Indian last name. Nikita Zhuk is a very likely name for a female from India =)

 Maybe this page, which conveniently belongs to a Nikita Zhuk involved in comp sci (a likely assumption for anyone related to TDWTF) and includes a picture of said Nikita Zhuk will clear up the specifics of this particular Nikita Zhuk:

http://www.cs.helsinki.fi/u/nzhuk/

Of course, someone will have to email Nikita Zhuk to see if we have found the right one.   

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 19:05 • by Nick
Alex Papadimoulis:

Nikita Zhuk thought there might be a deeper, more fundamental lack of understanding when she came across this question posted on Experts Exchange ...

hi all,


IntTemp = Int((255 * Rnd()) + 1)

I used above ASP.NET code. Problem is in " Rnd() "
Rnd() value is changing everytime.

What is the alternative for Rnd()?
OR How will stop Rnd() value changes at everytime?

change the 255 to a 0 and you'll get the same number each time.

That guy *really* should get the points for that question.

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 19:09 • by Quinnum
103504 in reply to 103480

Anonymous:
Anonymous:
Nikita Zhuk is definitely a "he", not "she"


Based on what? That you are Nikita Zhuk? I know two Nikitas and they are both female.

That would make Khrushchev about the ugliest chick in history. 

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 20:16 • by Layne
103507 in reply to 103504
And the whole shoe-pounding thing would be a bit ridiculous with a patent leather pump...

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 21:08 • by missing
103512 in reply to 103481

Anonymous:
How would you quantify an infinite value in a finite system? The best you can do is approximate it.

The same way you write infinity in a finite amount of time, make a special symbol for it. 

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 23:06 • by IronFist
103516 in reply to 103503
Anonymous:
You


Screw it, the captcha blocks it all in a few seconds. Anyone know the problem? FF for life.

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 23:47 • by DaBookshah
103517 in reply to 103498
Anonymous:
Anonymous:
Anonymous:

I competed in NWERC last sunday... See: http://www.csc.kth.se/contest/nwerc/2006/

The judge's solutions were posted today... I saw the following line in the code:

int INF=99999999 

How would you quantify an infinite value in a finite system? The best you can do is approximate it.

How would you quantify zero in a finite system? Assuming there's always two halves of any finite value



WTF?!??! That is the biggest wtf so far. Assuming your not being sarcastic

Re: Coded Smorgasbord: Prepare For Return

2006-11-24 23:59 • by EvanED
103518 in reply to 103481
Anonymous:
Anonymous:

I competed in NWERC last sunday... See: http://www.csc.kth.se/contest/nwerc/2006/

The judge's solutions were posted today... I saw the following line in the code:

int INF=99999999 



How would you quantify an infinite value in a finite system? The best you can do is approximate it.

 I'd approximate it with INT_MAX. Write out the value if I had to. At least that way you can't have a number bigger than infinity.
 

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 00:30 • by Wolven
103519 in reply to 103503

The Rand() question isn't really a WTF: all they wanted to do was seed Rand() before they call it, so that whatever seed will always map to a specific sequence of numbers from Rand(). The WTF is that there are "experts" on expert exchange who couldn't grasp that.

PS. Sorry if there are like 3 posts saying this exact same thing, but community server seems to be fucked up again, it keeps redirecting me to search whenever I quote-reply to something... Why does anyone bother with this software?
 

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 02:10 • by gblues
103525 in reply to 103519
Anonymous:

The Rand() question isn't really a WTF: all they wanted to do was seed Rand() before they call it, so that whatever seed will always map to a specific sequence of numbers from Rand(). The WTF is that there are "experts" on expert exchange who couldn't grasp that.

PS. Sorry if there are like 3 posts saying this exact same thing, but community server seems to be fucked up again, it keeps redirecting me to search whenever I quote-reply to something... Why does anyone bother with this software?
 

Indeed; the WTF for me is that I have to click on the comments link twice to get to the comments; the first time it just sits there for a day and a half; then when I click it again, it goes instantly.

WTF indeed.
 

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 02:59 • by A chicken passeth by
 
/*Added by Jiang W */
void ji_suan (int ni_hao)
{
int yi_shi = 0;
// yi_shi = 3 /*erase by Li K */
yi_shi = 3;
return;
}

 

Translation (programmer names omitted):

 void calculate (int hi_there)

{

    int meaning = 0

    //meaning = 3 /* erased by .. */ 

    meaning = 3

    return

}

...this looks like someone coding in Java for the first time or is trying out something, and is a function that does nothing (after all, it returns nothing despite it being void - god knows why it doesn't generate a compiler error).


 

existingCustomerForm.setError(Boolean.FALSE.booleanValue());

Well, he should be right at home with Visual Studio 2005 at least - you'd be suprised at the number of things you'd need these long lines of declarations for. Heck, you have to import namespace to get to use Booleans and Nulls in VS2005, otherwise you type something like the above. >_>

 

-------------------------------------------------------------
-- MBolton 2006-01-13
-- The //HACK to determine program's parent is very
-- brittle. Someone should probably fix that. In fact
-- if you're reading this, it's probably already broken.
-- Good luck.
-------------------------------------------------------------

 
It's official folks. Micheal Bolton is a closet programmer.

Oh, wait. <_<




 

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 03:48 • by Jasmine
103528 in reply to 103489
Hehe... yeah Elton John confused that whole issue when he made a song called 'Nikita' and then filmed the video with a very hot blonde woman. But doesn't everybody know that Elton John is gay? Clearly the song was about a man. Also, Kruschev was a 'Nikita', and he's definitely a man.

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 04:26 • by EV
103530 in reply to 103518
EvanED:
Anonymous:
Anonymous:

I competed in NWERC last sunday... See: http://www.csc.kth.se/contest/nwerc/2006/

The judge's solutions were posted today... I saw the following line in the code:

int INF=99999999 



How would you quantify an infinite value in a finite system? The best you can do is approximate it.

 I'd approximate it with INT_MAX. Write out the value if I had to. At least that way you can't have a number bigger than infinity.
 

INT_MAX may not always be the best value. I have to say I don't really concider this as a WTF, even though I made the first post here.

Let's say you have to calculate the minimum path from one point to another. You could just do:

pathlen = current_path + some_other_path;

if(pathlen &lt; oldpathlen)

   oldpathlen = pathlen;
 

This way you don't have to check for overflows and still just abuse infinity as being a valid value which will be forgotten because adding something to it will never make it lower than any value in the matrix.

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 05:05 • by Benjamin
103531 in reply to 103500
PlasmaHH:
Alex Papadimoulis:

From the Jan-Feb 1982 of Computer Gaming World (as discovered by Jaliya Jayawardena), here's how we used to patch games before that whole Internet thing was around ...



Full Size: http://img.thedailywtf.com/images/200611/1982_0102_issue2.gif

I cannot find much of a wtf here. Maybe it should better say IF RG<1 THEN RG=1. Really, preventing div by zero is so often done in a "lets use the smallest value near to 0 that makes sense" way, that even if it is wrong to do so (often enough its not) is not a wtf anymore.

But some of the others taught me to not drink while reading this site. Anyone knows how to get coke out of a laptops tft and keyboard?

 

It is not a wtf. As you may read just under the headline this whole post is about "fun-but-not-necessarily-bad code". It is not bad code, but I still thing it belongs there, because it is funny.

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 05:09 • by GettinSadda
103532 in reply to 103528
Anonymous:
Hehe... yeah Elton John confused that whole issue when he made a song called 'Nikita' and then filmed the video with a very hot blonde woman. But doesn't everybody know that Elton John is gay? Clearly the song was about a man. Also, Kruschev was a 'Nikita', and he's definitely a man.

Um, the song is actually about Nikita Kruschev

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 05:34 • by abx

Oh hells yea, that rnd() issue was on side bar once, and it actually stirred up discussion. Unbelievable

http://thedailywtf.com/forums/thread/98836.aspx 

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 06:56 • by Catch-22
Alex Papadimoulis:

From A, I guess this just gives a whole new meaning to "Infinity Plus One" ...

#define INFINITE	10000
I submitted this. The guy who wrote it spent a long time fiddling with the values of INFINITE before settling on 10000.
The real wtf for me was the fact that LARGEST_INT was defined in the compiler we were using. 

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 07:31 • by Jivlain
103539 in reply to 103534
abx:

Oh hells yea, that rnd() issue was on side bar once, and it actually stirred up discussion. Unbelievable

http://thedailywtf.com/forums/thread/98836.aspx 



Hoorah for MS Freecell, the game that actually allows you to set your seed!

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 11:38 • by qbolec

void ChuckNorris(){
   for(int i=INFINITE; i!=0 ; i+=ZERO){

      if( 0==ZERO) break;
   }
}

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 12:46 • by WIldpeaks
Alex Papadimoulis:

Oscar found this during a recent, and apparently much needed, clean up of the codebase for an application. Good for when the number line reverses itself I suppose?

if (Math.max(1, 2) == 2) return;

 

You never know, after spending 3 million years in suspended animation, they might go thru a time hole and end up on an Earth where time goes reverse. Enterprisey future proofness !

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 13:18 • by cwolves

I'm currently writing an app that, put simply, simulates an electrical diagram.  I have almost the exact same "#define INFINITE 10000" line, except I defined it as 1M.  Put simply, the number represents a resistance and is dropped into a matrix to calculate the voltage at a node.  With a high enough resistance, no electricity goes through the node, due to the other nodes having a resistance of around 10 ohms.  1,000,000 is a high enough number to effectively take the node out of the calculations, but not high enough (>= ~ 1*10^9) to screw up the floating point math so much that the rest of the numbers get thrown off (1000000000000000000+123.456789 = 1000000000000000100).

If I actually were to use the language's built in "INFINITY", I would get errors all over the place when I do "Infinity/Infinity" math (I want 1, but get an error).  Also, I actually need the extra numbers to be in the matrix, ie I need the number 1,000,015 to have the 15 in it, which Infinity would just drop.

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 13:36 • by UMTopSpinC7

That is by far my favorite one. 

Brandon strapped on his seatbelt and braced himself. He was prepared for return ...

  ...

/* Prepare for return. */
return;
}
 

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 13:47 • by aquanight
103558 in reply to 103527
Anonymous:


 

/*Added by Jiang W */

void ji_suan (int ni_hao)

{

int yi_shi = 0;

// yi_shi = 3 /*erase by Li K */

yi_shi = 3;

return;

}

 


Translation (programmer names omitted):


 void calculate (int hi_there)


{


    int meaning = 0


    //meaning = 3 /* erased by .. */ 


    meaning = 3


    return


}


...this looks like someone coding in Java for the first time or is trying out something, and is a function that does nothing (after all, it returns nothing despite it being void - god knows why it doesn't generate a compiler error).



Both Java and C/C++ allow return in a void function, even when it's pointless like it is here. It just has to be an empty return. (Reasons for doing it are about the same as using break in a loop.) Though, in the case, the return isn't necessary since void functions also allow falling off...



Anonymous:



 

existingCustomerForm.setError(Boolean.FALSE.booleanValue());


Well, he should be right at home with Visual Studio 2005 at least - you'd be suprised at the number of things you'd need these long lines of declarations for. Heck, you have to import namespace to get to use Booleans and Nulls in VS2005, otherwise you type something like the above. >_>



Except afaik you can configure the compiler to automatically import System and whatever else you need (Microsoft.VisualBasic for VB.NET, for example). It's a good idea to do it in the file though - you generally can only put so much on a commandline.

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 14:32 • by brill

F(*&($&#@#^$! forum software

 

I love the Rnd() WTF... they do say any monkey can write ASP... I guess that Monkey doesn't know that though. 

That's when your buddy says RTFM and you write a post to a forum asking what it means... and some one else says STFW and you ask your buddy what it means.

 

Sigh... why does this site always look so familiar?
 

Re: Coded Smorgasbord: Prepare For Return

2006-11-25 18:04 • by gl
Alex Papadimoulis:

(which simply processes a list of names and converts them to proper case)

 
Now this is a real wtf.  

Does anyone think that they can come
up with an algorithm that will convert names to 'proper' case?  My name
has a capital letter part-way through, but there are some branches of
the family that spell it with a lower-case letter (the split happened
somewhere in the early 1600's).  There are many other cases, especialy
when people have moved to another country and have converted to the
'proper' spelling for that country, but others have maintained the
original spellings (think about names that start with 'van der' or
Vander'.
 

 

 

« PrevPage 1 | Page 2Next »

Add Comment