|
My original post has been a litmus test.
What I'm doing is making a list of all the devs (very few) here at CP who actually say, "well, I understand this...life is real and code is ugly at times".
These are the people who I will accept their opinions when I write articles and post here to CP.
The rest I will ignore.
You are on the list for your understanding.
Don't let that get out or the other Engineers will harass you.
|
|
|
|
|
Your logic isn't quite the same.
The original logic does moveNext() at the end of the loop, always. While your logic does it first, before "doing something".
The for loop variant guarantees that moveNext() is done for each loop iteration. The while loop variant can be goofed up by other devs adding a continue before doing the moveNext() -- speaking from experience, having had to fix these sorts of problems.....
|
|
|
|
|
wrote: Your logic isn't quite the same.
Yes, others have pointed this out.
I just wrote the code sample real fast.
Now, the subtle error is bait for people with OCD.
Even the explanation of using the for loop in this case actually stinks the place up, because the original code writer probably didn't use critical thinking to consider that the loop will run once and then only increment to the next file after it gets to the bottom (after the first time through the loop).
I could've made it a do...while.
NOte: I'm not directing this criticism at you, just at any explanation of using the for loop for that reason.
modified 7-Nov-18 13:32pm.
|
|
|
|
|
This goes back to the (bad) old C days. To be cool, one would use fewer statements. For example, a forever loop we could use:
for (;;)
{
}
or
while (1)
{
}
It became in style to use the for. Besides, back in the days, C was done in Unix and code wasn't meant to be read by humans. And, the compiler didn't care how you formed your code.
|
|
|
|
|
... The bartender says: "Wow, I've never served a weasel before. What can I get you?"
"Pop," goes the weasel!
Yeah, yeah, I know! The door is thataway =>
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- Never argue with a fool. Onlookers may not be able to tell the difference. Mark Twain
|
|
|
|
|
Come on, do we really need another lawyer joke?
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
Forogar wrote: Come on, do we really need another lawyer joke?
FTFY
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
Boom!
|
|
|
|
|
A weasel walks onto a landmine...
Ron Anders wrote: Boom!
|
|
|
|
|
Seems like the Boom has been lowered!
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- Never argue with a fool. Onlookers may not be able to tell the difference. Mark Twain
|
|
|
|
|
Doh! Some things you just can un-see or un-read.
|
|
|
|
|
Perfect! My work here is done (for today!)
Anything that is unrelated to elephants is irrelephant Anonymous
- The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944
- Never argue with a fool. Onlookers may not be able to tell the difference. Mark Twain
|
|
|
|
|
That's the way the money goes!
"Go forth into the source" - Neal Morse
|
|
|
|
|
A topical one for Londoners
Stab and die maybe you would be safer here (7)
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
"A Bedsit"?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Good effort but nope
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
I did it yesterday, so I thought I'd play with the anagram instead of answering!
Mind you, you're lucky if you can afford to buy a bedsit in Londinium these days ... or unlucky, in that it probably means you live there.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I have a clue that needs using, so...
Bastide = safe place
Anagram of stab and die.
|
|
|
|
|
You are up tomorrow sir well done
We can’t stop here, this is bat country - Hunter S Thompson RIP
|
|
|
|
|
I was just having a read over the wiki page[^], does anybody else find this sentence a bit strange?
wiki page: The bastides were so successful against their opponents in the Hundred Years War that the English adopted them for themselves, first in France and later in Wales.
That doesn't make sense right? Or is it trying to imply that the English built them in France and Wales while they were hanging out over there?
|
|
|
|
|
I was trying to find a way to stretch Beirut to 7 letters.
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
In those situations (like most) it is best to just pass the blame. Just state the answer as fact, and tell the OP that they counted wrong.
The key to making this work is: don't back down! They will eventually tire and just let you have it
|
|
|
|
|
That could be a viable approach.
My preemptive answer for tomorrow is:
HADDOCK (too obvious to require an explanation!)
Now to think of a clue for Thursday ...
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
PeejayAdams wrote: HADDOCK
Once owned, since lost. Where my boat sleeps next to a fish (8)
|
|
|
|
|
Are you sure you counted right? The answer is quite clearly POLLOCK but that only has 7 letters ...
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|