what're the Label_xxxx in decompiled code?

B

Bob

I was looking at some of the Framework code using the .NET Reflector.
There're some places where there're these Label_xxxx lines, e.g.:

......
if (string.IsNullOrEmpty(this.Url))
{
goto Label_0174;
}
Label_00C2:
if (base.DataSources.Count == 0)
{
goto Label_0189;
}
goto Label_0194;
Label_00D7:
.......................

What would these labels be in the original code? I guess the compiler
rearranged the branching logics and the decompiler simply wouldn't know what
the original code looks like?
 
B

Barry Kelly

Bob said:
I was looking at some of the Framework code using the .NET Reflector.
There're some places where there're these Label_xxxx lines, e.g.:

.....
if (string.IsNullOrEmpty(this.Url))
{
goto Label_0174;
}
Label_00C2:
if (base.DataSources.Count == 0)
{
goto Label_0189;
}
goto Label_0194;
Label_00D7:
......................

What would these labels be in the original code?

What you're seeing is a limitation of the decompilation support of
Reflector. In general, arbitrary code can be decomposed into switch
statements, if statements, jumps, assignments and method calls.
Extracting higher-level structures such as while / for / foreach etc.
relies on pattern-matching, heuristics, etc.
I guess the compiler
rearranged the branching logics and the decompiler simply wouldn't know what
the original code looks like?

It's also possible that goto was used to escape from deeply nested
loops, or to perform some other control flow not possible with purely
structured programming primitives.

-- Barry
 

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

Similar Threads


Top