Submitter: William Melgaard
Submission Date: December 9, 2015
Subject: N1989: C language extension
I would like to propose an addition to the ANSI C language.
Breaking from multiple nested loops has always been a problem. My current practice is:

int i, j, k, n=5;
k=0;
for(i=0; i<10; i++){
  for(j=0; j<10; j++){
    if(j == n){
      k=1;
      break;
    }
   if(k) break;
  }
}

The alternative is to use a goto, which is recommended against.

My proposal is to allow an argument to "break". Thus, in the above example,
int i, j, n=5;
for(i=0; i<10; i++){
  for(j=0; j<10; j++){
    if(j == n)  break 2; // The 2 indicates break two loops
  }
}

// break = break 0 = break 1

I believe this addition to the standard would have universal appeal.

William Melgaard