INF: Jumping into the Middle of a For Loop Is Not Recommended

ID Number: Q19972

3.00 4.00 5.00 5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a

MS-DOS | OS/2

Summary:

In Microsoft C versions 5.0, 5.1, 6.0, 6.0a, 6.0ax, and C/C++ version

7.0, the only restriction on the goto statement is that the goto

statement and its corresponding label be located in the same function.

However, because different compilers optimize for loops differently,

using a goto to jump into the middle of a for loop is not considered

safe or portable.

Also, if you are jumping into an inner loop that uses auto variables,

an additional problem may occur because different compilers allocate

space for auto variables in loops in different ways.

Essentially, it is risky and not advisable for a program to jump into

the middle of a for loop.

Additional reference words: 5.00 5.10 6.00 6.00a 6.00ax 7.00