|
You have to be at least a little bit insane to be a developer. It's OK.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
that code means that it must really be 'true' not 'TRUE' or 1, or even non-zero.
There are a lot of cases where it makes sense. So such code might get enforced by some source code scanner policies.
You learn to honor such tools, when co-working with some code-jockeys
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: There are a lot of cases where it makes sense In some alternate universe perhaps.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
KarstenK's post reminds me of DCL and the many things that test as True -- including (but not limited to) 'Y', '1'...
|
|
|
|
|
Because Javascript equality is so f*cked that you have to know when to use == vs. === , and even then there's some weird BS with the null, empty, void, dunno, you're guess is as good as mine states that a Javascript variable can be in that it only makes sense to equate to a literal string?
Marc
Latest Article - Merkle Trees
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
for (int i = 0; i < foo.Length; i++)
{
addFlag = true;
if (oldFoo != null)
{
for (int j = 0; j < oldFoo.Length; j++)
{
if (foo[i].Guid == oldFoo[j].Guid)
{
addFlag = false;
}
}
}
if (addFlag)
{
newFooList.Add(foo[i]);
}
}
I should start holding code review classes with "WTF is wrong with this pyle of shyte".
Marc
|
|
|
|
|
Marc Clifton wrote: I should start holding code review classes with "WTF is wrong with this pyle of shyte". Too much accolades, right? I also added another for-loop, since you were going through the items in the wrong order.
for (<span int i = 0; i < foo.Length; i++)
{
addFlag = true;
if (oldFoo != null)
for (int j = 0; j < oldFoo.Length; j++)
for (int d = oldFoo.Length; d > 0; d++)
if (foo[i].Guid == oldFoo[j].Guid)
addFlag = false;
if (addFlag)
newFooList.Add(foo[i]);
} Semantically also incorrect, since "addFlag" is unknown at the start. The code should reflect that by using a nullable bool that is set to nothing. That way, you could determine (if an exception occurs) if the bool is unknown, true, or not very true.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: for (int d = oldFoo.Length; d > 0; d++)
There's at least 3 bugs in that one line!
Marc
|
|
|
|
|
You can improve performance by adding a "; " after "for (int d = oldFoo.Length; d > 0; d++) ". But I guess a smart guy like you introduced this possibility for exactly that purpose. Let's hope the compiler did not detect that and optimized it away...
|
|
|
|
|
|
0x01AA wrote: Dont't blame the people, try to help them
They're no longer here and were in India.
0x01AA wrote: If I Review some of my 30 year old code, a lot of time I'm asking me if I would know the guy who wrote this s**t
A client is still using code I wrote in C++ 25 years ago. I grimace every time I see DataMatrix , basically the .NET version of DataTable .
Marc
|
|
|
|
|
The answer is: YES
"Share your wisdom and enlight the clueless". It is good for your karma
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
And the answer to your question would be, but I found it on stackoverflow.
|
|
|
|
|
You cannot see the deeper meaning here. It is not user-friendly to make it too efficient[^].
|
|
|
|
|
This is why we need faster and faster processors. Think of it as price support for Intel.
|
|
|
|
|
Followed by some counter increments.
Marc
|
|
|
|
|
Code was changed but comment wasn't? Or comment was copied from somewhere else and never edited? Or the developer was suffering from hypocaffenation?
Or whoever wrote that was a complete idiot?
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Kind of reminds me of one one Jeff Spicoli, on fixing a car.
Quote: Relax, all right? My old man is a television repairman, he's got this ultimate set of tools. I can fix it.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
comment said:
|
|
|
|
|
raddevus wrote: Right. Use the third person instead.
The language is JavaScript. that of Mordor, which I will not utter here
This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a f***ing golf cart.
"I don't know, extraterrestrial?"
"You mean like from space?"
"No, from Canada."
If software development were a circus, we would all be the clowns.
|
|
|
|
|
I write often comment for my "future self" like "HACK", "TODO"
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
|
That reads like a Daily Affirmation with Stuart Smalley. Brilliant!
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
#region Note To Future Developer
#endregion
Zen and the art of software maintenance : rm -rf *
Maths is like love : a simple idea but it can get complicated.
|
|
|
|
|
At my first job we had a senior developer who was very into OOP. Only problem is the code base was Microsoft C 5.1. The guy was building C code like it was C++ classes, few people could follow it. After he moved on to bigger and better things I got to debug some of his stuff and found a comment like
"We aren't supposed to free() the same pointer twice but since it doesn't hurt anything"
Coming from Mister High and Mighty "Your code better conform and produce no warnings."
|
|
|
|