![]() |
| | #1 |
| Guest
Posts: n/a
| int main() { int err = 0; ... err = Function1(); if( err != 0 ){ ... return 1; } ... err = Function2(); if( err != 0 ){ ... return 2; } ... err = Function3(); if( err != 0 ){ ... return 3; } ... return 0; } OR: int main() { int err = 0; ... err = Function1(); if( err == 0 ){ ... err = Function2(); if( err == 0 ){ ... err = Function3(); if( err == 0 ){ ... } } } return err; } |
|
| | #2 |
| the hat of redundancy hat Join Date: Aug 2001 Location: Hannover, Germany
Posts: 2,768
| a) this is the C# board ![]() b) >Which code is more effective? That depends on the situation. They both do the same, in the same amount of time. How you format it in the end is likely to be influenced by existing coding standards for your workplace or your own habits. Most effective is the version that is easier to read. But there is no perfect solution to this, as people are still arguing what is easier to read
__________________ hth -nv She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate." When in doubt, read the FAQ. Then ask a smart question. |
| nvoigt is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Extended ASCII Characters in an RTF Control | JustMax | C Programming | 18 | 04-03-2009 08:20 PM |
| Enforcing Machine Code Restrictions? | SMurf | Tech Board | 21 | 03-30-2009 07:34 AM |
| Values changing without reason? | subtled | C Programming | 2 | 04-19-2007 10:20 AM |
| Updated sound engine code | Bubba | Game Programming | 8 | 11-18-2004 12:38 PM |
| Interface Question | smog890 | C Programming | 11 | 06-03-2002 05:06 PM |