Bartosz Milewski Missing post
Jason House
jason.james.house at gmail.com
Wed May 27 05:27:02 PDT 2009
The article implies some level of flow analysis. Has Walter come around on this topic?
As far as considering a variable moved, I believe the following should be reasonable
Any if statement (or else clause) containing a move
Any switch statement containing a move for any case
Any fall-through cases where the prior case moved the variable
Any function call not using a lent argument for the variable
Moving inside a loop should be illegal
An explicit is null check should be able to bypass these rules. There are probably ways to loosen the looping rule such as if there is a way to guarantee the moved variable won't be read from again.
Very similar rules can be used for detecting initialization of (unique) variables. A variable can be considered initialized if:
Both the if and else must initialize a variable
All cases in a switch must initialize a variable
Out parameter in a function call
Loops can't initialize variables
relaxation: can init if guaranteed to run at least once
Those rules should be sufficiently simple to implement and extremely tolerable for programmers.
Inevitably, I missed a case, but I hope the idea is clear, and that whatever I overlooked does not add complexity.
Bartosz Milewski Wrote:
> The post is back, rewritten and with some code teasers.
>
> Nick B Wrote:
>
> > Hi
> >
> > It seems that Bartosz's latest post, dated April 26 th is missing from
> > his blog.
> >
> > See :
> >
> > http://bartoszmilewski.wordpress.com/
> >
> >
> > Nick B.
>
More information about the Digitalmars-d
mailing list