c++llvmgoto

What is the Microsoft goto extension?


I am writing a C++ generator, that needs to use the goto statement. I am compiling my code with clang++ and get the warning [-Wmicrosoft-goto] on some of my gotos. All of my gotos only jump around inside a single function even without stack variable declarations, and I cannot see any difference from when I get the warning to when I get no warning.

I really would like to use a C++ conforming goto, but I cannot find any information about what the Microsoft extension is.

Can you please tell me what the Microsoft goto extension is, and what triggers that warning in clang++?


EDIT:

I did have a stack variable that was being jumped over, so that is the difference. I solved it by putting the part with the stack variable in {} and now the warning does not appear anymore.

In my defense, I was hoping someone just knows what the Microsoft goto extension is, or knows better how to find a documentation that states what it is.


Solution

  • even without stack-variable declarations

    Are you sure? The only conformance flag for Visual C++ that mentions goto is /Zc:gotoScope, which flags

    goto statements that jump over the initialization of one or more local variables.