Sigh
-
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
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
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 ( 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. :rolleyes:
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)
-
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
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
-
Dont't blame the people, try to help them :-D 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 :laugh: [Edit] The same happens also with code I wrote just before some days :-O
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 ofDataTable
. MarcV.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
-
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 ( 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. :rolleyes:
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)
Eddy Vluggen wrote:
for (int d = oldFoo.Length; d > 0; d++)
There's at least 3 bugs in that one line! ;) Marc
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
-
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 ( 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. :rolleyes:
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)
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... :-D -
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
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
And the answer to your question would be, but I found it on stackoverflow.
-
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
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
You cannot see the deeper meaning here. It is not user-friendly to make it too efficient[^].
-
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
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation 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
This is why we need faster and faster processors. Think of it as price support for Intel.