|
Witness the following C# piece of code:
var x = 0;
x = x++;
What does this even means? How could x be equal to x++? It's obviously different!
Well now imagine the following Java code
int x = 0;
x = x++;
Now imagine the C# is, in fact, doing the same thing!
Bazongas!
The value of x is so obvious now! Obviously 1 or 0!
|
|
|
|
|
The equivalent of that code in C# would also be using an "int". Exactly like below;
int x = 0;
x = x++; ..which IS your java-example. The "var" keyword is not meant to be used as a replacement for int, and anyone doing so should stop coding.
It clearly has a joke icon.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Super Lloyd wrote: int x = 0;
x = x++;
I knew that this was going to result in x being 1, so to confirm I tested it and yes as I knew it results in x being 0.
It's a nasty little b*gger that one and I hope I never come across it in code.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
GuyThiebaut wrote: It's a nasty little b*gger that one and I hope I never come across it in code.
I dunno, seen a few juniors doing just that,
also other juniors that told them to stop as it might cause an endless loop.
When that comes out it's time for a coffee - away from the office.
Format Succe&*(gD@@@ @@@@@@*@x@@
|
|
|
|
|
Confiscate their coding licenses.
|
|
|
|
|
harold aptroot wrote: Confiscate their coding licenses
You are much too lenient. That sort of blunder calls for staking out on an anthill, at the very least!
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
|
Jörgen Andersson wrote: RSPCA
The Royal Society for the Prevention of Cruelty to Ants?
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.
--Winston Churchill
|
|
|
|
|
Perhaps it is because you don't know how to program in C#?
|
|
|
|
|
hmmm. maybe though. But I guess I have some level of proficiency in C# and have being doing some real complex stuffs... But for once I came across need for Data-flow (Producer consumer pattern with BlockingCollection) I found an example of BlockingQueue in java very handy and translate to c#.
|
|
|
|
|
Have a look at the TPL Dataflow library. It's stupid easy and does the job nicely without needing any of that mungy blocking.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Dgmarious wrote: But... I am not that Java guy. That's good. Most of the Java guys I met were fanatics, as if the language had been invented as part of a clever plan by Scientology.
I am endeavoring, ma'am, to construct a mnemonic memory circuit using stone knives and bearskins.
|
|
|
|
|
CodeWraith wrote: Most of the Java guys I met were fanatics
I encountered that 25 years ago. Gads, is it still true today, or did they all become Ruby fanatics?
|
|
|
|
|
At least those that tried to assimilate me about four years ago still were.
I am endeavoring, ma'am, to construct a mnemonic memory circuit using stone knives and bearskins.
|
|
|
|
|
Essentially, if you know Java, then you're basically familiar with C#. Even a lot of the class names are the same.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
|
As your other post eluded to, yeah, Java loves its patterns, and sometimes there's a gem in some Java example. On the other hand, the reason Java loves its patterns so much is that doing complex things in Java is so much more of a PITA.
|
|
|
|
|
Joint in the Spanish area of London (5)
98.4% of statistics are made up on the spot.
|
|
|
|
|
Joint in
the Spanish EL
area of London BOW
ELBOW
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
A Mercury Prize winging itself your way ...
|
|
|
|
|
This is awesome![^]
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Brilliant.
|
|
|
|
|
A horse, a horse. My Kingdom for a horse!
... such stuff as dreams are made on
|
|
|
|
|
After two weeks of playing with a 3D printer, I finally have some useful results. This is a landing gear I have made for a 1/16 scale Seaking. The landing gear is going to be retractable and the model is going to fly, of course.
Constructing and printing a landing gear[^]
I am endeavoring, ma'am, to construct a mnemonic memory circuit using stone knives and bearskins.
|
|
|
|
|
Do the cut out circles in the flange add strength? Or are they cut out to reduce weight?
Never underestimate the power of human stupidity
RAH
|
|
|
|