JonasToth added a comment.

In https://reviews.llvm.org/D41815#973265, @lebedev.ri wrote:

> In https://reviews.llvm.org/D41815#973260, @JonasToth wrote:
>
> > - check that jumps will only be forward. AFAIK that is required in all 
> > sensefull usecases of goto, is it?
>
>
> You could implement loops/recursion with goto, something like:
>
>   const int end = 10;
>   int i = 0;
>   assert(i < end);
>  
>   begin:
>   <do stuff>
>   i++
>   if(i < end)
>     goto begin;
>  
>   // end
>
>
> But it really should be done with normal `for()`, or `while()`, so i think it 
> would make sense to diagnose those.


That check is specifically targeting these code constellations to be bad 
practice. As you said, using the looping constructs is the way to go :)


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D41815



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to