|
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
|
|
|
|
|
This is a piece of code that I got to see from a project that has come to us for porting it to .NET. Nobody from our company is "technically challenged" enough to write something like that.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
if (!(i & (12|19|26|33))) i++;
|
|
|
|
|
I don't think this is correct
if you or 12 with 19you get 31 all of them give you 63
this means that (i & (12|19|26|33)) == (i & (63)) and that
will be true for 63 and for 177 and for 191 and so on ...
The following should be correct
<code>if(!( i==12 || i==29 || i==26 || i==33)) ++i;</code>
codito ergo sum
|
|
|
|
|
Yeah you right, im kinda brain dead at the moment :p
|
|
|
|
|
leppie wrote: at the moment
Only at this moment ?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
Not bad coding
Regards
Bino
http://www.technix.co.nr
|
|
|
|
|
For me, the Problem here is not the if, but the arcane magic in those numbers.
Why exactly 13?
And what makes 20 different from 21?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|