Someone please help me ....
-
... have to work with people who wrote this GEM
if(i==0)
*outcallRecvCount = 0;
else
*outcallRecvCount = i ;:~
C++ where friends have access to your private members !
:~ pretty much sums it up.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
-
I don't actually see something wrong with this. I could be that that i changes between
if(i==0)
and
*outcallRecvCount = i;
But then they should have protected it with CRITICAL_SECTIONS ;P
Learn from the mistakes of others, you may not live long enough to make them all yourself.
Well, IF the variable did change the code would make a bit more sense.... I believe what he meant was the pattern if (someCondition) doSomething(); else doExactlyTheSameThing();
-
That's legitimate, because the author needed
*outcallRecvCount = 0;
instead of
*outcallRecvCount = 0 ;
on
i==0
:-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Oh I see it's the space before the semi-colon...
-
Lovely! :doh: What is even more disgusting is that I've seen similar code in the product I am working on. You know, things like:
if (thisBoolVar == true)
{
thatBoolVar = true;
}
else
{
thatBoolVar = false;
}It is quite painful to have to be in areas of this code...
We can build upon this!
try
{
if (thisBoolVar == true? true : false)
{
thatBoolVar = (thisBoolVar != false? true : false);
}
else
{
thatBoolVar = (thisBoolVar == false? false : true);
}
}
catch {}if (thatBoolVar != thisBoolVar) ...
-
Oh I see it's the space before the semi-colon...
Exactly. :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
... have to work with people who wrote this GEM
if(i==0)
*outcallRecvCount = 0;
else
*outcallRecvCount = i ;:~
C++ where friends have access to your private members !
Resign now. Don't expose yourself to such level of idiocy, unless you really need the money. And if you can't resign, ensure you make your coworker feel "proud" enough of his achievement to never do such a thing again! Ok, don't be too harsh.
To those who understand, I extend my hand. To the doubtful I demand: Take me as I am. Not under your command, I know where I stand. I won't change to fit yout plan. Take me as I am.
-
I don't actually see something wrong with this. I could be that that i changes between
if(i==0)
and
*outcallRecvCount = i;
But then they should have protected it with CRITICAL_SECTIONS ;P
Learn from the mistakes of others, you may not live long enough to make them all yourself.
BadKarma wrote:
But then they should have protected it with CRITICAL_SECTIONS
There is only one situation where I would expect to see code like this: when one wants to set a breakpoint at i == 0 in the debugger, and one doesn't want to slow execution within the debugger by creating a conditional breakpoint.
-
And people ( especially non-programmers/managers ) don't understand why I say that just because it seems to work doesn't mean that it is good code. :) Bill W
CIDev wrote:
And people ( especially non-programmers/managers ) don't understand why I say that just because it seems to work doesn't mean that it is good code.
Sometimes, when I tell a manager about the Obscure C contest, tne light goes on :laugh:
-
... have to work with people who wrote this GEM
if(i==0)
*outcallRecvCount = 0;
else
*outcallRecvCount = i ;:~
C++ where friends have access to your private members !
Monty2 wrote:
if(i==0)
*outcallRecvCount = 0;
else
*outcallRecvCount = i ;Actually, I use constructs similar to this while debugging. Conditional breakpoints can be very expensive in time when one is running a source-level debugger. To avoid dying of old age while the program executes in the debugger, I'll create an if-block like this, then set an unconditional breakpoint on, say, the *outcallRevCount = 0 line; that way, the debugger runs much faster, and I get the debugger to stop when i == 0. Leaving it in production code, however, is sloppy to say the least.
-
CIDev wrote:
And people ( especially non-programmers/managers ) don't understand why I say that just because it seems to work doesn't mean that it is good code.
Sometimes, when I tell a manager about the Obscure C contest, tne light goes on :laugh: