Re: while (1) vs. for ( ;; )



In article <df0ea6$8il$1@xxxxxxxxxxxxxxxx>,
Christopher Benson-Manica <ataru@xxxxxxxxxxxxxxxxxxxxx> wrote:

> Richard Heathfield <invalid@xxxxxxxxxxxxxxx> wrote:
>
> > I'm quite unlikely to use multiple returns
>
> Would you suppose that such a view is common in the world of
> professional programming? My work experience is still quite limited,
> and it's hard to tell ubiquitous programming conventions from
> idiosyncratic oddities...

There are different styles. A relatively common one goes like this: At
the start of a function, lots of quick checks for error conditions,
trivial calls, etc. with quick returns. Then the actual work is done,
and there is one single return at the end of the function. Sometimes the
return statement has a label with goto statements going to that label,
sometimes nested if's or multiple if's are used.

Multiple returns within the function body (after the initial quick
checks) can be a huge maintenance problem, if you find out you have to
add some code that needs executing before returning from the function.

People have different styles, and if people tell you "always do X" then
often X is correct 99% of the time, and with some experience you will
know when you run into the 1% when "always do X" is wrong.
.



Relevant Pages

  • Re: When the winning probability grows proportionally with the number of lines
    ... lines of the system must not contain more than 1 common number. ... chances of some sort of win, whilst lowering the chances of multiple ... possibility of multiple wins then you've maximised the chance of some ... one number is shared amongst more than one ticket. ...
    (rec.gambling.lottery)
  • Re: Deploy multiple .Net web services?
    ... GAC is better if you are going to use the same libaries from multiple ... It is a one time install and makes things simple. ... Now I am experiencing problems in deploying .Net web services to ... the common libraries. ...
    (microsoft.public.dotnet.framework)
  • Re: Individual E Mails to Multiple Contacts
    ... I go through a process of making multiple copies of the ... > common message, open one at a time and then add the individual e mail ... Thank You, JAD. ... you check with your ISP on the number of allowed recipients per message. ...
    (microsoft.public.outlook.general)
  • Is it really document mgmt? I dont know what I need, so heres the problem....
    ... common shared server for saving our files. ... multiple copies with minor changes, ... something that creates and saves versions olf documents, ...
    (comp.doc.management)
  • Re: Full sheet of same label
    ... so I get a full sheet of each record rather than just one label of each? ... A common way to get multiple copies of a data record os to ...
    (microsoft.public.access.reports)