|
Georgi Atanasov wrote: Obviously the line
OnCommandExecuting(e)
was missing
Uh, yeah.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The actual code is a bit different, but the essence was that the developer who wrote it screwed up big time. Converting string to string is a bit useless in my humble opinion
void SaveUserText(string userText) {
string text = userText.ToString();
}
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog
|
|
|
|
|
I suprised that there isn't an assert there as well.
void SaveUserText(string userText)
{
string text = userText.ToString();
assert ( text == userText );
}
Chris Meech
I am Canadian. [heard in a local bar]
|
|
|
|
|
Surely that would be
void SaveUserText(string userText)
{
string text = userText.ToString();
assert ( (string)text.ToString() == (string)userText.ToString() );
}
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Oh, but of course!
|
|
|
|
|
I tryed it ....it crashes....why?;P
Russell
|
|
|
|
|
There was some SQL I had to maintain a few years back where the original programmer had done something like ToChar(ToChar(datevalue)) (I forget the exact syntax, it was RDB) several times.
The guy who'd been maintaining said things like: "It's always been like that.", "It ain't broke.", and "He said it wouldn't work otherwise."
I darn well fixed it anyway. With that and some other changes the program ran in ten minutes instead of forty.
|
|
|
|
|
He said "It ain't broke" not "It aint slow"
|
|
|
|
|
Hahaha, FxCop thought otherwise.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
My blog
|
|
|
|
|
In my recent quests to solve an issue with legacy code, I found several places where code blocks are wrapped in
#if NOT_USED
...
#endif
This is confusing to me since if NOT_USED is defined, then the code will be compiled into the project.
Phil
|
|
|
|
|
Indeed, should be #if 0 or #if false or something.
|
|
|
|
|
Sounds like someone's not using version control on the source, or if they are, they are afraid of using the delete key to actually remove the code. I find this to be the least confusing way of ensuring that code is not compiled into a project.
Chris Meech
I am Canadian. [heard in a local bar]
|
|
|
|
|
Don't get technical with your new fangled ways. I'm just surprised he didn't use a hex editor on the compiled code.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I think the point is that NOT_USED could be defined at some point, and hose things up.
|
|
|
|
|
You're correct and I understood that point. But, I see that my response could be mis-interpreted from that. For me, if I want to ensure that code is not compiled, I prefer to use the delete key and depend upon source control to preserve the code.
Chris Meech
I am Canadian. [heard in a local bar]
|
|
|
|
|
Chris Meech wrote: depend upon source control to preserve the code
Well, as long as it's not VSS.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yes, delete is good for the soul.
|
|
|
|
|
Actually the point is that there are many other ways to exclude code from being compiled, but using #ifdef NOT_USED creates confusion as to the intentions of the original developer.
I prefer to be perfectly clear if I don't want the code compiled and either comment it out (with an explanation) or delete it entirely.
Phil
|
|
|
|
|
It only confuses stupid people.
|
|
|
|
|
There are lots of moronic things people can do to hose things up ... defining NOT_USED is just one of them. It could be called DONT_DEFINE_THIS_BECAUSE_IT_EXCLUDES_CODE_THAT_SHOULD_NOT_BE_COMPILED and one could just as well define that.
|
|
|
|
|
|
The programmer who wrote it must suffered from depression... I would rather use IsTrue - it's definately more optimistic, isn't it?
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
|
|
Indeed, one if is better.
Also revert logic and set ++i; at the end of the code. This gives another performance boost.
codito ergo sum
|
|
|
|