5 years of experience but WTF!
-
Vikram A Punathambekar wrote:
BTW, the if brace is not matched.
Is it? Looks matched to me??? Nunc est bibendum
It was not. He edited it. Now it is. :) Cheers, Vikram.
http://www.geocities.com/vpunathambekar
Google talk: binarybandit
After all is said and done, much is said and little is done.
-
It was not. He edited it. Now it is. :) Cheers, Vikram.
http://www.geocities.com/vpunathambekar
Google talk: binarybandit
After all is said and done, much is said and little is done.
-
Mr.Prakash wrote:
What is wrong in this? or are you sarcastic?
Yes, I was being sarcastic. Because if you're writing:
if (somecondition) functioncall(true);else functioncall(false);
you might as well write:
functioncall(somecondition);
right? Marc My website Traceract Understanding Simple Data Binding Diary Of A CEO - Preface
I love that one. Each time I see something like
Marc Clifton wrote:
if (somecondition) functioncall(true);else functioncall(false);
or the variation
if(condition)
return true;
else
return false;instead of
return condition;
I am split between laughters and tears :sigh:
The great error of nearly all studies of war has been to consider war as an episode in foreign policies, when it is an act of interior politics - Simone Weil Fold with us! ¤ flickr
-
I was code reviewing one of my team members code change. This is how it was,
void foo(...) { int abc = 0; . . . if(somecondition) { functioncall(...,abc); } else { abc = 1; functioncall(...,abc); } }
the param takes either 0 or 1. what happend to boolean?!? why cant true or false be passed directly to the function? Have you guys ever experienced such absurd codeing from a 5 year experienced guy?
-prakash -- modified at 5:16 Saturday 15th October, 2005
If the code is supposed to be portable and compile with any C compiler(note not C++), then the 5 year guy isn't as dumb as you think. Bool does not exist in ANSI C.
-
I was code reviewing one of my team members code change. This is how it was,
void foo(...) { int abc = 0; . . . if(somecondition) { functioncall(...,abc); } else { abc = 1; functioncall(...,abc); } }
the param takes either 0 or 1. what happend to boolean?!? why cant true or false be passed directly to the function? Have you guys ever experienced such absurd codeing from a 5 year experienced guy?
-prakash -- modified at 5:16 Saturday 15th October, 2005
Why were you voted down for this one? Anyone care to explain?
-
Mr.Prakash wrote:
void foo(...){ int abc = 0; . . . if(somecondition) { functioncall(...,abc); } else { abc = 1; functioncall(...,abc); }}
Or how about: void foo(...) { . . . if(somecondition) { functioncall(..., 0); } else { functioncall(..., 1); } } or: void foo(...) { . . . functioncall(..., !somecondition); } or use the ?: operator. Mind you, I can write perfectly good crap when I'm in the mood, like: if(somevalue = TRUE) dosomething(); But then we use the PREFAST DDK compiler to catch this. It is interesting though, in this world of auto checking compilers etc how a code review can pull out a load of bugs and innefficiencies. Nunc est bibendum
you could not actually guess the right answer coz for the right answer there are many other things involved. I just gave a small section to highlight the point of passing the param to the function.
-prakash
-
Why were you voted down for this one? Anyone care to explain?
xlr8td wrote:
Why were you voted down for this one? Anyone care to explain?
I guess many 5 year experienced guys didnt find that a problem.
-prakash
-
If the code is supposed to be portable and compile with any C compiler(note not C++), then the 5 year guy isn't as dumb as you think. Bool does not exist in ANSI C.
Tim Ranker wrote:
then the 5 year guy isn't as dumb as you think. Bool does not exist in ANSI C.
He is, I know him for past 2 year ;)
-prakash
-
I was code reviewing one of my team members code change. This is how it was,
void foo(...) { int abc = 0; . . . if(somecondition) { functioncall(...,abc); } else { abc = 1; functioncall(...,abc); } }
the param takes either 0 or 1. what happend to boolean?!? why cant true or false be passed directly to the function? Have you guys ever experienced such absurd codeing from a 5 year experienced guy?
-prakash -- modified at 5:16 Saturday 15th October, 2005
My, aren't we full of ourselves... How can anybody here agree or disagree with you without seeing th code within it's complete context. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
-
Why were you voted down for this one? Anyone care to explain?
Most of my posts get voted down because they someone doesn't like something I said here five years ago. Go figure... ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
-
My, aren't we full of ourselves... How can anybody here agree or disagree with you without seeing th code within it's complete context. ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
John Simmons / outlaw programmer wrote:
How can anybody here agree or disagree with you without seeing th code within it's complete context.
There you have a point but When I put up that post, My point was of very obvious mistake of adding an additional variable which is used in only thouse 2 lines, which a 5 year experienced guy should have avoided. Yes, I pointed out the mistake and spoke to him and he accepted his mistake and corrected the code.
-prakash