Use of unassigned local variable?

R

Ravichandran J.V.

The "meta" part is that for a loop to be unrolled the compiler would
have to unroll the loop at compile time (which is somewhat metaprogram).

I do not see where the optimization part comes in because according to
your code, what if the try block fails within the loop, how will
Hello=a3; be resolved? I guess it is fairly logical for the compiler to
say that "since I do not know what will happen to the assignment that is
not in the same scope, hence am generating a unassigned local variable
usage error".

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com
 
L

Laura T.

Ok, I see your point in the "meta" part.

The a3 will be assigned by the catch all block:

catch (Exception)
{
ret = true;
a3 = "sa";
}

I cannot find any dataflow graph that leaves a3 unassigned, even with
exceptions. Is there one?
 
R

Ravichandran J.V.

I guess you have already resolved it as due to invariant type being
pulled out of the loop. Incidentally, even though you say that when an
exception is thrown you have resolved the assignment in the Catch block
but remove the loop and the same error will be generated by the compiler
for the reason that I had given in the earlier post.

I am not sure about the dataflow graph. How did you see the dataflow
graph?

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top