why does ForStmt have a CondVar field?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

why does ForStmt have a CondVar field?

Ted Kremenek
I noticed that ForStmt has a CondVar field, similar to the condition variable field for IfStmt and WhileStmt.  Unlike these other Stms, however, ForStmt uses a DeclStmt for the initialization expression.  From what I can tell, the CondVar field in ForStmt is always NULL.

Is it needed?  It also doesn't make semantic sense, since there is no notion of one condition variable, as one can declare multiple variables in the initialization of the ForStmt.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: why does ForStmt have a CondVar field?

Eli Friedman
On Wed, Dec 23, 2009 at 5:08 PM, Ted Kremenek <[hidden email]> wrote:
> I noticed that ForStmt has a CondVar field, similar to the condition variable field for IfStmt and WhileStmt.  Unlike these other Stms, however, ForStmt uses a DeclStmt for the initialization expression.  From what I can tell, the CondVar field in ForStmt is always NULL.
>
> Is it needed?  It also doesn't make semantic sense, since there is no notion of one condition variable, as one can declare multiple variables in the initialization of the ForStmt.

void a() { for (int x = 0;int y = x;x++) {} }

-Eli

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: why does ForStmt have a CondVar field?

Ted Kremenek

On Dec 23, 2009, at 5:21 PM, Eli Friedman wrote:

> On Wed, Dec 23, 2009 at 5:08 PM, Ted Kremenek <[hidden email]> wrote:
>> I noticed that ForStmt has a CondVar field, similar to the condition variable field for IfStmt and WhileStmt.  Unlike these other Stms, however, ForStmt uses a DeclStmt for the initialization expression.  From what I can tell, the CondVar field in ForStmt is always NULL.
>>
>> Is it needed?  It also doesn't make semantic sense, since there is no notion of one condition variable, as one can declare multiple variables in the initialization of the ForStmt.
>
> void a() { for (int x = 0;int y = x;x++) {} }
>
> -Eli

Right, thanks Eli.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev