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?

  • When you look at the Linux kernel source, you find a lot of goto out; in functions, sometimes also to different label like out1, out2 etc. See also blog.regehr.org/archives/894
    – ott--
    Commented Mar 4, 2015 at 13:49
  • 1
    Did you ask whomever asked you to fill out the documentation? Can you track it back it its author & request clarification. Perhaps the document itself could be updated? "did you use any unconditional jumps (i.e goto or break)?"
    – Mawg
    Commented Mar 5, 2015 at 7:35
  • Related: softwareengineering.stackexchange.com/questions/409878/…
    – john c. j.
    Commented May 27, 2020 at 12:48

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
    Commented 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
    Commented 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 Commented 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
    Commented Mar 4, 2015 at 12:14
  • @Solver you jump to after the else, in other words to the code outside the if-else Commented 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
    Commented Mar 4, 2015 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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