|
Its probably safe in that sense, the compiler will most likely just put make the End If the target of a Jump instruction.
For a loop, it would be horrible. In C++, that could cause RAII to break, but in VB its probably safe. No guarantees though (but where GOTO's are used, most guarantees are probably invalid anyway).
|
|
|
|
|
It's a long time since I've used "proper" C or C++, but in C#, it won't even compile as the label is out of scope of the goto
|
|
|
|
|
String amount = "123";
var actualAmount = Convert.ToDecimal(String.Format(CultureInfo.InvariantCulture ,"{0:N2}",
Convert.ToDecimal(amount, CultureInfo.InvariantCulture)),CultureInfo.InvariantCulture);
|
|
|
|
|
You've got more chance of peeing on JSOP's porch than you have of understanding why the developer did this.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
I think the developer was unhappy with the performance of Decimal.Round so decided to implement it using strings, as we know computers prefer working with text rather than numbers...
|
|
|
|
|
Rounding is a hard, let's go shopping!
|
|
|
|
|
I can sort of understand the point.
It looks like it is trying to round the amount down to 2 decimal places.
Odd way to go about it though.
Reminds me of the old "man with a hammer" quote.
|
|
|
|
|
Unfortunately the original code monkey was using the hammer on his own skull.
Software Zen: delete this;
|
|
|
|
|
public virtual object DeepCopy(object value)
{
return value;
}
|
|
|
|
|
|
Or just give the method a decent name, like DeepCopyIfNeeded .
|
|
|
|
|
Manfred R. Bihy wrote: Looks like the coder should have thrown a NotImplementedException[^] here instead.
One of the most underused exceptions when developing software. I use it all the time when I am scoping out classes, but not ready to implement the inner code yet.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
It's a great way to detect that something isn't quite done yet.
Cheers!
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
Yes, but if he used a NotImplementedException then it wouldn't be a coding horror. Unless, of course, it was still there when released to customers.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
Coincidentally, we just found exactly this yesterday in our latest release.
Release was pretty much a complete rewrite of the software, so this is a "TODO that didn't get to did", not something malicious. Oops.
Now off to the old code to figure it out and design a solution in the new architecture.
|
|
|
|
|
Manfred R. Bihy wrote: Looks like the coder should have thrown a NotImplementedException[^] here instead.
Rather a
NotImplementedHereSoGoOnException
(yes|no|maybe)*
|
|
|
|
|
Horrible!!! It's not even a copy, it's just the same object passed back to the caller.
|
|
|
|
|
Perhaps he means "Deep" in some Buddist-type sense, with a more profound meaning, like a copy of something is the same thing as the original or something. Actually, if this is the case the methdod should have been called ProfoundCopy
|
|
|
|
|
PlatonicCopy: A material copy that is merely a flawed and incomplete projection of the immaterial class.
Giraffes are not real.
|
|
|
|
|
|
In other cultures that's referred to as a Zen copy. You have become one with the object.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
If this was C++, see my sig.
Software Zen: delete this;
|
|
|
|
|
Code like this is probably one reason why
is not a standard xml comment.
No one would want to own up to that.
|
|
|
|
|
Perhaps the coder's name is Dot Stop Period.
Narf.
|
|
|
|
|
This looks like a laid off employee who would like damage the company without the risk of being sued.
"To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson
|
|
|
|