|
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
|
|
|
|
|
Ah! I had to give the thread a title. As you said, there's nothing to do with the number of if conditions there. The WTF in the code is that the coder did not know of the term called "decrement operator"
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
brahmma wrote: The WTF in the code is that the coder did not know of the term called "decrement operator"
Well - how would that (or the use of the inverse logic proposed by leppie make things any clearer?
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
|
|
|
|
|
Why decrement if you don't have to increment in the first place ?
codito ergo sum
|
|
|
|
|
That isn't our company code! Just see how many WTFs are there apparently within a few lines of code.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
Maybe it's only for those numbers that it should be decremented again, in which case a simple range check would suffice rather than what was provided.
|
|
|
|