foreach ... else statement
Walter Bright
newshound1 at digitalmars.com
Tue Jan 6 20:57:50 PST 2009
grauzone wrote:
> bearophile wrote:
>> Don:
>>> Actually Walter loves goto, so DMD copes really well with it.
>>
>> When possible it's better to use structured programming and avoid
>> gotos. That construct can avoid gotos in some common situations.
>> And regarding the compiler back-end, I think it's also better to start
>> thinking what's good for LDC :-)
>
> I don't know how relevant this is, but: LLVM uses SSA for registers, and
> it seems to be simpler to convert code to SSA if there are no gotos:
>
> "We show that it is possible to generate SSA form in a single pass (even
> during parsing) if the program contains only structured control flow
> (i.e., no gotos). For such programs the dominator tree can be built on
> the fly, too."
>
> http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.45.4503
I don't know what they're talking about. The D optimizer has no trouble
whatsoever building dominator graphs, no matter what rat's nest of gotos
are used. This technology was well understood in 1980.
In fact, the front end deconstructs *everything* into gotos, and that's
all the optimizer works with.
More information about the Digitalmars-d
mailing list