|
Russell Jones wrote: bool foo(int n)
{
if (n > 16)
return true;
else if (n <= 16 && n>4)
return false;
else if (n <= 4)
return true;
}
But it too would be better though as:
bool foo(int n)
{
return ((n > 16) || (n <= 4));
}
|
|
|
|
|
Indeed..what thought is required to come to that conclusion??
|
|
|
|
|
Ummm....
<br />
if (n > 16)<br />
return true;<br />
else
return false;<br />
|
|
|
|
|
shadayim wrote: i love this one!
Me too: 5 .
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]
|
|
|
|
|
I've processed that code with WinZip.
The result is:
bool foo(int n) { return (n > 16); }
modified on Tuesday, November 4, 2008 4:34 PM
|
|
|
|
|
Vincenzo Rossi wrote: I've processed that code with WinZip.
I used my brain and got:
n > 16
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
I could surrender, but often human beings are stupid and proud.
So I must reply...
Hmmm, ok..
1. this expression cannot be used as callback funcion
2. If you use that expression in many place of your code, instead of using a central function, you have to change the literal 16 in all places. Use a costant at least.
3. Why not waste some stack space? ahah
Greetings
Vin
|
|
|
|
|
That is called "Defensive Programming"
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
Chris Maunder wrote: That is called "Defensive Programming" Roll eyes
Is that because many, many, many military developers use such paradigms?
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]
|
|
|
|
|
Because the developer says, "I was told to do it that way."
|
|
|
|
|
Indeed.
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]
|
|
|
|
|
PIEBALDconsult wrote: Because the developer says, "I was told to do it that way."
If this is defensive programming, there must also be offensive programming and I'd kill them all - programming - because there are a lot of people out there (they call themselves also programmers, so be careful.. ) who give a damn on what someone else is saying, even if it might be their boss. They stick to their bad coding habits regardless of what's happening around them...
Regards
Thomas
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Programmer - an organism that turns coffee into software.
|
|
|
|
|
|
|
Too good.
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]
|
|
|
|
|
dan neely wrote: http://gradha.sdf-eu.org/textos/klingon_programmer.en.html[^]
One of those sounds too familiar - on our team comments are generally frowned on - especially those that may document the parameters of a function. The boss' logic? Comments frequently aren't maintained so end up out-of-date.
I'm not sure about this one - I get his point, but I'd rather see a slightly off-topic comment (and correct it when I realised) than have to work out everything's purpose from scratch the first time its encountered (or when sufficient time has passed since you last looked).
Then again, there seem to be no concerns about line length either. I've encountered lines of code over 1000 characters wide, so not only are there no comments, but I have to keep scrolling sideways to see the code itself. Often, the most important work is done by a function call hidden away a few screens beyond my screen estate.
|
|
|
|
|
|
Pick me please, I could use the money! But lets do this off the forum. Send me your details at AnIdiot@Morons.com[^]
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Oh please not in this place,
software developers are people that normally use their brains...
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Programmer - an organism that turns coffee into software.
|
|
|
|
|
I have some $20 Mil Oceanfront Property in Arizona for sale if you're interested.
|
|
|
|
|
Don't you try and sell him something! - you may offend him.
He wants to donate without having any earthly reward for it (like your ridiculous 'Oceanfront Property in Arizona')...
Regards
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Programmer - an organism that turns coffee into software.
|
|
|
|
|
Mister Kofi Ado,
If you have 9,5 mil (nine and a half million) that you want to get rid off...
share it with the codeproject community, we will be very happy with your money
you want anything in return? I'm sure we can provide you a good program that helps you spamming messageboards. (but we can't garantee bugs that might f**k up your pc)
<< Nearly all men can stand adversity, but if you want to test a man's character, give him power. >>
|
|
|
|
|
Dabi dabi dabi.
Me nim wo, Kofi Ado.
Wo n'ye.
|
|
|
|
|
Sounds tempting, however it occurs to me that if you're smart enough to steal that much from your company, then you're smart enough to cheat me out of my share, so just eff off.
|
|
|
|
|
Dear Mr.Kofi Ado, I've really very interested in you proposal, unfortunately I'm unreliable, dishonest and absolutely NOT trustworthy (you know, drugz...).
Anyway I beg you, since badly need your money!
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]
|
|
|
|