Click here to Skip to main content
14,934,114 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: Avoid return statement in the middle - horror or not? Pin
Robert.C.Cartaino6-Dec-08 6:05
MemberRobert.C.Cartaino6-Dec-08 6:05 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
riced6-Dec-08 8:30
Memberriced6-Dec-08 8:30 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
PIEBALDconsult7-Dec-08 6:15
professionalPIEBALDconsult7-Dec-08 6:15 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
Michael Dunn7-Dec-08 20:40
sitebuilderMichael Dunn7-Dec-08 20:40 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
MP310-Dec-08 1:13
MemberMP310-Dec-08 1:13 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
PIEBALDconsult10-Dec-08 3:16
professionalPIEBALDconsult10-Dec-08 3:16 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
Andrew Torrance8-Dec-08 22:23
MemberAndrew Torrance8-Dec-08 22:23 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
Robert.C.Cartaino9-Dec-08 3:56
MemberRobert.C.Cartaino9-Dec-08 3:56 
Andrew Torrance wrote:
if( !FlagA || !FlagB || !FlagC) // Select Variant on !Flagx or Flagx == false depending on language
DoOtherThing();
else
{
if(PromptUser())
DoSomething();
}


...except if PromptUser() fails, you also have to execute DoOtherThing(). So you need to add to your code:
if( !FlagA || !FlagB || !FlagC) // Select Variant on !Flagx or Flagx == false depending on language
    DoOtherThing();
else
{
    if(PromptUser())
        DoSomething();
<code>    else
        DoOtherThing();</code>
}

GeneralRe: Avoid return statement in the middle - horror or not? Pin
PIEBALDconsult9-Dec-08 4:22
professionalPIEBALDconsult9-Dec-08 4:22 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
Ben Fair9-Dec-08 6:54
MemberBen Fair9-Dec-08 6:54 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
geoffs9-Dec-08 10:05
Membergeoffs9-Dec-08 10:05 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
FatBuddha10-Dec-08 4:11
MemberFatBuddha10-Dec-08 4:11 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
PIEBALDconsult10-Dec-08 8:35
professionalPIEBALDconsult10-Dec-08 8:35 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
FatBuddha10-Dec-08 14:48
MemberFatBuddha10-Dec-08 14:48 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
PIEBALDconsult10-Dec-08 15:43
professionalPIEBALDconsult10-Dec-08 15:43 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
FatBuddha11-Dec-08 3:04
MemberFatBuddha11-Dec-08 3:04 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
PIEBALDconsult11-Dec-08 6:14
professionalPIEBALDconsult11-Dec-08 6:14 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
supercat915-Dec-08 11:57
Membersupercat915-Dec-08 11:57 
GeneralRe: Avoid return statement in the middle - horror or not? [modified] Pin
PIEBALDconsult15-Dec-08 13:33
professionalPIEBALDconsult15-Dec-08 13:33 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
supercat916-Dec-08 8:14
Membersupercat916-Dec-08 8:14 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
PIEBALDconsult16-Dec-08 13:13
professionalPIEBALDconsult16-Dec-08 13:13 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
supercat916-Dec-08 17:20
Membersupercat916-Dec-08 17:20 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
PIEBALDconsult17-Dec-08 12:24
professionalPIEBALDconsult17-Dec-08 12:24 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
Lutosław12-Dec-08 10:11
MemberLutosław12-Dec-08 10:11 
GeneralRe: Avoid return statement in the middle - horror or not? Pin
PIEBALDconsult12-Dec-08 10:45
professionalPIEBALDconsult12-Dec-08 10:45 

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.