for (DWORD I=0; I & lt; PTransMesh - & gt; DwFaceCount; I++) { For (DWORD dwItem=0; DwItem & lt; 3; DwItem++) { If (MinPointCoord. V [dwItem] & gt;=pNoTransMesh - & gt; TriangleDivision. VuNumDivisionUnit [dwItem]) Goto NextTriangle;//use the continue here can't control the cycle } ,,,,,,,,,,,,,, NextTriangle://here say I syntax errors, depressed } Why have such a stupid design?
CodePudding user response:
For (DWORD I=0; I & lt; PTransMesh - & gt; DwFaceCount; I++) { For (DWORD dwItem=0; DwItem & lt; 3; DwItem++) { If (MinPointCoord. V [dwItem] & gt;=pNoTransMesh - & gt; TriangleDivision. VuNumDivisionUnit [dwItem]) Goto NextTriangle;//use the continue here can't control the cycle } ,,,,,,,,,,,,,, NextTriangle: ; //I found here to add one more pause, speechless, otherwise you will compile error } CodePudding user response:
No; (empty statement), it is not a statement!
CodePudding user response:
Don't hold goto not to put, you need is just a break; statements
CodePudding user response:
The
reference 3 floor bluesen response: don't embrace goto not to put, you need is just a break; Statement You didn't understand what I mean, I want to jump to the next cycle, and also is the break out of the recent cycle, the two nested loops, like me as control don't break the outer loop CodePudding user response:
reference 4 floor WJN92 response: Quote: reference bluesen reply: 3/f Don't hold goto not to put, you need is just a break; Statement You don't understand what I mean, I want to jump to the next cycle, and also is the break out of the recent cycle, the two nested loops like me, don't break the same control the outermost loop Controlled variable, the goto statement is obviously reflected poorly designed CodePudding user response:
You can say, but can't say it's defects, CodePudding user response:
Goto NextTriangle change: /////////////////////////////////////// { Flag=TRUE;//add BOOL flag=FALSE; break; }//2 nd for If (flag) { Flag=FALSE; continue;//1 st for } . CodePudding user response:
reference 5 floor bluesen reply: Quote: refer to 4th floor WJN92 response: Quote: refer to the third floor bluesen response: Don't hold goto not to put, you need is just a break; Statement You don't understand what I mean, I want to jump to the next cycle, and also is the break out of the recent cycle, the two nested loops like me, don't break the same control the outermost loop Controlled variable, the goto statement is obviously reflected poorly designed I don't understand why do you do that? Make the code more bloated do? CodePudding user response:
refer to 7th floor schlafenhamster response: goto NextTriangle change: /////////////////////////////////////// { Flag=TRUE;//add BOOL flag=FALSE; break; }//2 nd for If (flag) { Flag=FALSE; continue;//1 st for } . refer to 6th floor marslycan response: you could say that, but can't say it's defects, I don't understand why such a design are there CodePudding user response:
Because sometimes all kinds of error need to goto into a common error handling function CodePudding user response:
For (DWORD I=0; I & lt; PTransMesh - & gt; DwFaceCount; I++) { For (DWORD dwItem=0; DwItem & lt; 3; DwItem++) { If (MinPointCoord. V [dwItem] & gt;=pNoTransMesh - & gt; TriangleDivision. VuNumDivisionUnit [dwItem]) Goto NextTriangle;// according to your logic, goto you need is a break rather than continue } ,,,,,,,,,,,,,, NextTriangle:// then you need at least one statement, add a semicolon short statement, why not? } CodePudding user response:
The building Lord said no goto code bloat, Python not goto someone did not show the code bloat, you're welcome to say program design entry, you need to do to the disadvantages of goto statements as early as in almost 50 years ago has been finalized, Edsger Wybe Dijkstra in 1968 wrote the famous "goto statements are harmful", Suggest to search for "spaghetti code", CodePudding user response:
The refer to 12 floor worldy reply: for (DWORD I=0; I & lt; PTransMesh - & gt; DwFaceCount; I++) { For (DWORD dwItem=0; DwItem & lt; 3; DwItem++) { If (MinPointCoord. V [dwItem] & gt;=pNoTransMesh - & gt; TriangleDivision. VuNumDivisionUnit [dwItem]) Goto NextTriangle;// according to your logic, goto you need is a break rather than continue } ,,,,,,,,,,,,,, NextTriangle:// then you need at least one statement, add a semicolon short statement, why not? } Break is also the current loop, "NextTriangle:" there are a lot of code above, I need to enter the next cycle, is no longer need to execute the following code CodePudding user response:
reference 13 floor bluesen reply: the original poster said not goto code bloat, Python not goto someone did not show the code bloat, you're welcome to say program design entry, you need to do to the disadvantages of goto statements as early as in almost 50 years ago has been finalized, Edsger Wybe Dijkstra in 1968 wrote the famous "goto statements are harmful", nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull