I have to fill out some documentation regarding a C project i worked on. One topic is whether I used "unconditional jumps".

As far as I know, a "break" statement counts as a jump. And I have a few of those that fire when a condition in a loop is met. Does that make it a "conditional jump"?

Another example is when there are standard "break" statements in a switch case, are those conditional or unconditional?

Basically, what constitutes an "unconditional jump" in C?


2 Answers 2


It is a matter of terminology.

IMHO, any break, continue, goto, return which is not in the body of an if or else or case is an inconditional jump.

So obviously

if (foobar) goto somelabel; 

is a conditional jump.


if (foobar) {
   x = something();
   y = other(x);

I would believe that the return is conditional. Some people might object that because of the previous statements it is not (and only the entire block is conditional)

BTW, I heard of "unconditional jump" more when speaking of machine code than everything else.

Read also about basic blocks

I believe that your bureaucracy is just asking you if you used goto; you could ask your management or client about what is really meant. I feel sorry for you that you have to lose your time on such (IMHO stupid or useless) questions.

  • Our train of thought is similar. And my documentation DOES originate from a machine code background. I guess it is a rather gray area when it comes to C.
    – Nitkov
    Mar 4, 2015 at 12:05

Conditional means it may not be followed depending on some condition. Unconditional means that is program flow reaches that point it always will continue at the target.

A if and a switch are a conditional jumps.

At the end of the then clause of an if is an unconditional jump to after the else clause. breaks in a switch are also unconditional.

  • How is there an unconditional jump after the then clause? Wouldn't we ALWAYS jump to the else clause then? If not, how is it UNconditional?
    – Nitkov
    Mar 4, 2015 at 12:01
  • @Solver after you finish the then clause you need to skip the else (by definition of the clauses), that requires a unconditional jump Mar 4, 2015 at 12:02
  • @ratchet_freak Why would you jump to "else" if the first "then" was true? Something I am missing?
    – Nitkov
    Mar 4, 2015 at 12:14
  • @Solver you jump to after the else, in other words to the code outside the if-else Mar 4, 2015 at 12:24
  • A break in a case label is obviously conditional, as it depends on the switch condition being hit in the first place. All jumps are unconditional once you've passed the test condition. Therefore you must always have the right scope in mind, and the right scope for break is exactly the full switch statement (you don't break to the next case label or back to the caller of the function).
    – MSalters
    Mar 4, 2015 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.