|
takeBulletPointList();
removeSpaces();
camelCaseItAll();
addParensAndSemicolon();
pretendItsCode();
Not that clever or original.
|
|
|
|
|
getTested() creates a conundrum without an if (i.e. "If I suspect ...")
For a "voluntary" test to be effective, one should isolate until the results are known (which is usually impractical).
If one doesn't isolate, the implication is that one suspected one was sick (and therefore got tested), but did not isolate and therefore was careless. Some have been fired over this (testing positive later).
My sense is, unless you suspect you're sick, getting tested is pointless unless you are part of a large scale screening process (which I agree with).
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Or you're going to travel to another location that requires either a clean test or a quarantine.
|
|
|
|
|
I didn't write it, but ... the author thinks this is a good idea that should be allowed in C# code:
getSeries()
{
if (flag == pass) goto ep;
for i1 ...
...
for i2 ...
...
for i3 ...
...
for i4 ...
.
.
.
for ...
{
...
return;
ep;
}
}
}
}
} Me? I'm not a fan.
Your thoughts - and remember this is the Lounge?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You need to tell the author he's in the wrong job. He needs to find something where logic and common sense isn't required. Management, maybe?
|
|
|
|
|
|
He would probably ace politics...
|
|
|
|
|
Not sure what it does, especially goto part. But reminds of person who skipped recursion class...
|
|
|
|
|
Without knowing the range of the for loops, and how many there are, I wouldn't recommend recursion, because it might overflow the stack.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Are you being ironic? Or do you actually think it's better to use nested fors explicitly, instead of passing a depth limit as a parameter of a recursive function?
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
0) If you need to specify a depth limit, you have problems elsewhere in the implementation.
1) It's impossible for us to properly evaluate the code without knowing much more about it. Right now, everyone's just throwing darts...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
OriginalGriff wrote: code review Sorry, what does that mean?
|
|
|
|
|
Did you mean
ep: return; to assuage those who believe a function should only return in one place?
|
|
|
|
|
The ep label is after the return statement, in the OP (pseudo) code.
|
|
|
|
|
That's why I asked. Jumping into the middle of a for loop makes no sense to me.
|
|
|
|
|
|
Looks like a fruity loops kind of guy
|
|
|
|
|
It comes from an old, working C++ project, which, in turn comes from an older, working C project, which, in turn, comes from an ancient, ugly, not-working assembly project.
|
|
|
|
|
The first and most important question - does it work?
The second question, how long ago was it written and what were the time-constraints and pressures of the project?
It's easy to stand there and criticize other peoples work. Pretty sure no matter what you produce code-wise there will be better ways to do it either now or in the future.
I never understand why people feel the need to post things like this - I'd guess some underlying insecurity issues...
|
|
|
|
|
Apparently so, in C++. In C# (his target language) no - the label is out of scope of the goto.
It was apparently written in 2006 ... and in my opinion you shouldn't try to perpetuate code crimes into new languages.
To be honest, any coder who thinks nesting loops 5+ deep is a good idea probably needs a lesson in exponential growth ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Ooh, I thought C++ initialised variables to 0 by default - apparently not. So this is undefined behaviour if any of the loop variables are used after the goto is executed. Fnu
|
|
|
|
|
Certainly not. What would the loop variables be set to when you jumped into the middle of the loop?
You can sort-of mimic something similar with an async method, by putting a yield return; in the inner loop. But IIRC, the compiler has to rewrite that as a state machine, because jumping into the middle of a loop just doesn't make any sense.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I review my own code - so I suppose, if I wrote it, it would pass.
But I didn't - looks more like something one of our overseas contractors would do.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
It's this new cool style of programming named For-Oriented Programming, or FOP for short.
I think I'll try it out on my next project
|
|
|
|
|
Sander Rossel wrote: For-Oriented Programming, or FOP
|
|
|
|