Click here to Skip to main content
15,896,606 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: top this Pin
Bigdeak12-Aug-10 21:40
Bigdeak12-Aug-10 21:40 
GeneralHow to read a file completely? Pin
Bernhard Hiller29-Jul-10 2:22
Bernhard Hiller29-Jul-10 2:22 
GeneralRe: How to read a file completely? Pin
Single Step Debugger29-Jul-10 3:35
Single Step Debugger29-Jul-10 3:35 
GeneralRe: How to read a file completely? Pin
Phil Martin29-Jul-10 13:15
professionalPhil Martin29-Jul-10 13:15 
GeneralRe: How to read a file completely? Pin
David Skelly29-Jul-10 22:34
David Skelly29-Jul-10 22:34 
GeneralRe: How to read a file completely? Pin
Luc Pattyn30-Jul-10 0:02
sitebuilderLuc Pattyn30-Jul-10 0:02 
GeneralRe: How to read a file completely? Pin
David Skelly30-Jul-10 2:29
David Skelly30-Jul-10 2:29 
GeneralRe: How to read a file completely? Pin
Luc Pattyn30-Jul-10 2:53
sitebuilderLuc Pattyn30-Jul-10 2:53 
You're right, the break prevents an eternal loop. Nevertheless the following is the normal way:
try
{
    do
    {
        int a = 1;
        int b = 0;
        int c = a / b;
    } while (true);
}
catch (Exception ex)
{
    MessageBox.Show(ex.ToString());
}


as its structure better matches the intended operation, which is illustrated by the fact the break is not present anymore.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.


GeneralRe: How to read a file completely? Pin
David Skelly30-Jul-10 4:18
David Skelly30-Jul-10 4:18 
GeneralRe: How to read a file completely? Pin
PIEBALDconsult30-Jul-10 6:21
mvePIEBALDconsult30-Jul-10 6:21 
GeneralRe: How to read a file completely? Pin
Luc Pattyn30-Jul-10 6:26
sitebuilderLuc Pattyn30-Jul-10 6:26 
GeneralRe: How to read a file completely? Pin
MalikRizwan22-Sep-10 0:09
MalikRizwan22-Sep-10 0:09 
GeneralRe: How to read a file completely? Pin
Luc Pattyn22-Sep-10 2:02
sitebuilderLuc Pattyn22-Sep-10 2:02 
GeneralRe: How to read a file completely? Pin
MalikRizwan22-Sep-10 19:27
MalikRizwan22-Sep-10 19:27 
GeneralRe: How to read a file completely? Pin
Luc Pattyn22-Sep-10 19:39
sitebuilderLuc Pattyn22-Sep-10 19:39 
GeneralRe: How to read a file completely? Pin
Bernhard Hiller1-Aug-10 20:02
Bernhard Hiller1-Aug-10 20:02 
GeneralRe: How to read a file completely? Pin
itsravie3-Aug-10 0:33
itsravie3-Aug-10 0:33 
AnswerRe: How to read a file completely? Depends on how you read the file. Pin
Dwayne J. Baldwin3-Aug-10 20:38
Dwayne J. Baldwin3-Aug-10 20:38 
GeneralRe: How to read a file completely? Pin
Machaira4-Aug-10 2:24
Machaira4-Aug-10 2:24 
GeneralBored of if..else? Pin
Dan_Martin28-Jul-10 22:45
Dan_Martin28-Jul-10 22:45 
GeneralRe: Bored of if..else? Pin
Keith Barrow29-Jul-10 2:57
professionalKeith Barrow29-Jul-10 2:57 
GeneralRe: Bored of if..else? Pin
Jeroen De Dauw29-Jul-10 3:09
Jeroen De Dauw29-Jul-10 3:09 
GeneralRe: Bored of if..else? Pin
Samuel Cragg30-Jul-10 12:29
Samuel Cragg30-Jul-10 12:29 
GeneralRe: Bored of if..else? Pin
Gary R. Wheeler1-Aug-10 0:21
Gary R. Wheeler1-Aug-10 0:21 
GeneralRe: Bored of if..else? Pin
bleedingfingers3-Aug-10 2:10
bleedingfingers3-Aug-10 2:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.