May 26, 2005
Walter wrote:
<snip>
> The easiest example is:
> 
> int test(Collection x)
> {
>     foreach (int i; x)
>         if (foo(i))
>             return i;
> }
> 
> Is foreach guaranteed by the algorithm to never terminate? The compiler
> can't tell. Being forced to insert a return statement at the end will be
> confusing and misleading to the maintenance programmer. This, with many pros
> and cons, was hashed out in great detail a few months ago.

Is it me, or are you talking at cross purposes with the rest of us?  You give an example of a function that may or may not encounter a return statement.  A decent number of us are talking about functions that have no return statements in them at all.  Was I imagining it, or did the compiler use to catch these?

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.
1 2 3
Next ›   Last »