|
Yeah, probably. I would assume that originally they wanted the while and later decided otherwise; I would either have removed the while or made the break conditional.
|
|
|
|
|
I have on occasion used:
{
...
do {
...
if (condition) break;
...
if (condition) break;
...
} while(0);
... with the while() "loop" being merely a block from which the code could "break". I wonder if the code here began as something similar, but replacing an "if()" and "do {} while()" with a "while()" and a "break".
|
|
|
|
|
No, that horror is by people who think it's less of a horror than a goto .
|
|
|
|
|
PIEBALDconsult wrote: No, that horror is by people who think it's less of a horror than a goto.
Many modern languages support exceptions on the basis that conventional structured programming constructs can't practically handle everything that programs need to do. In languages which support exceptions, they should be used when appropriate. What would you suggest doing, if not a 'goto' or 'break', in situations where an exception would be appropriate but the language doesn't support them?
BTW, I wish some standards agency would draft an extension of the C99 standard which would allow something like exceptions but only within a particular function (C++, which allows full-fledged extensions, already exists, but run-time support for exceptions requires too much overhead to be practical on some smaller microcontrollers; limited support for exceptions within a function could improve program structure without impacting code size, speed, or RAM requirements.
|
|
|
|
|
Huh? I use goto when necessary (which is very rare).
|
|
|
|
|
goto bathroom.
goto kitchen.
goto pub.
They seem necessary
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Only the bathroom is a necessary.
|
|
|
|
|
Just an optional requirement..... 
|
|
|
|
|
I don't have the exact code, but a while ago I've seen someone do something like this in VB.Net:
sub codeHorror()
dim amount as integer
dim isTrue as boolean
amount = cint(textbox1.text)
' some unrelated code
isTrue = cbool(amount)
' Some unrelated code
amount = cint(isTrue)
messagebox.show(cstr(amount))
end sub
The person who did this had little experience with coding, but had done application design on paper (with PST'z) for almost half a year - proof of my school failing at teaching logically.
GSoC 2009 student for SMW!
---
My little forums: http://code.bn2vs.com
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
You know ... sometimes I think that the compiler should'nt compile such a code !! and display a message for the developer :"For God Sake What with the hell is that !!!"
Sincerely Samer Abu Rabie
Imagination is more important than knowledge !
|
|
|
|
|
Paperclip: I see that you are trying to... (scratches head) what exactly are you trying to do?
|
|
|
|
|
Sincerely Samer Abu Rabie
Imagination is more important than knowledge !
|
|
|
|
|
The other day I saw a code where the developer intended to check his code by displaying a message box in ASP.NET applicatoin if a condition is true, in order to accomplish this he refrenced the System.Windows.Forms assembly and called the MessageBox to display his message.
When running the code, it actually worked !! and displayed the message successfully !!!
I freezed when I saw this ! How come a windows form control message box is displayed on the browser ?!
Actually it makes all the sense to be displayed from a technical point of view ... but it will create a disaster when its really used !!! what actually happens is that when the MessageBox is displayed the thread of the process is freezed until the User clicks ok !!!! and what user is that ... figured out the trick ?!!?
Let me give an example : the application on server ABC and some user on machine xyz is browsing the application, now when he faces the condition and the message should be displayed it will not be displayed to XYZ User !!! it will be displayed on ABC server since its a server side call !!!!
Now he had no clue about that because he was in development time on his machine, and his machine in debugging is the server as well, so he was able to see the message box with no problem
It's a codding horror no doubt ... but it makes an asp.net developer thinks more realistic and deeper on the behaviour of his own applications !!!
Sincerely Samer Abu Rabie
Imagination is more important than knowledge !
modified on Sunday, May 17, 2009 3:59 AM
|
|
|
|
|
Samer Abu Rabie wrote: asp.net
You should have said that up front.
|
|
|
|
|
That's a multi threaded fail process alright
GSoC 2009 student for SMW!
---
My little forums: http://code.bn2vs.com
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
You'd be amazed how many people writing asp.net code actually do not understand how/where it runs.
|
|
|
|
|
If it is intended for use in production code it is a real horror. If it is just a diagnostic messagebox that will be removed for production code then it is not too bad; the programmer has to be sure to remove it though
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
In a phone conference today with both technical and subject matter people, it was asked:
"So, we are trying to use a stored procedure for something other than a stored procedure?"
Yes, he is not a database person if you wanted to ask.
|
|
|
|
|
They likely meant that what ever was implemented using a stored procedure, should probably have been implemented in a different manner. Regardless, it is a poorly worded question that is more confusing than understandable.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
I'm with Chris.
Stored procedures are overused nowadays and are often used when a simpler technique will suffice.
|
|
|
|
|
|
It's a pity that this scheme for line-numbering does not work
|
|
|
|
|
OMG!!!!!!!!!!!!!!!!!!! ripe my eyes out now!!!!!!
|
|
|
|
|
I think a part of me just died. I counted at least 8 things wrong with that snippet
|
|
|
|
|
Not bad there are 9 lines of actual code
Never underestimate the power of human stupidity
RAH
|
|
|
|