Skip to content

Nested loop example #112

Description

@lwli11

To save time, some templates for annotations for common constructs should be provided. I had to look through the git issues to find this was how to write the nested loop annotation. It was not clear that in inner loop needed the annotation to be i<10i32 instead of i<=10i32:

int test(){
        //int i=0;
        //int j=0;
        int v=0;
        for (int i=0; i<10; ++i)
                /*@
                  inv i>=0i32; i<=10i32;
                  @*/

        {
                for (int j=0; j<10; j++)

                        /*@
                          inv
                          i>=0i32; i<10i32;
                          j>=0i32; j<=10i32;
                          @*/
                {

                        v=0;
                }


        }
        return 1;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions