Talk:Branch (computer science)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computer science (Rated Stub-class, Mid-importance)
WikiProject icon This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Stub-Class article Stub  This article has been rated as Stub-Class on the project's quality scale.
 Mid  This article has been rated as Mid-importance on the project's importance scale.
 

Cleanup[edit]

I've added the cleanup tag, mostly because of the last half of the article. It says that branch instructions can be taken or not taken --- this is only true of conditional branches, not branches in general. This is then mentioned again in the last sentence of the paragraph. --Ferris37 17:05, 3 October 2006 (UTC)

In general, it is completely true that a branch can be taken or not taken. Every branch is either taken or not taken. It is just that unconditional branches are always taken and conditional branches involve a choice. I think the article is pretty good on this point: it defines the terms taken and not taken, then tells us that unconditionals are always taken, conditionals depend on a condition. Is this not clear? NicM 17:34, 3 October 2006 (UTC).

Merge proposal[edit]

There are three articles which roughly deal with the same (or largely overlapping) subjects: Branch (computer science), Conditional branch, and Jump instruction. I think it makes sense to consolidate them. I'm not particularly happy with the name of this article being qualified with "(computer science)" since there are other computing uses, as with Branching (software). Perhaps "Branch instruction" may be better? But first lets merge and then deal with the names. -- Dmeranda 07:39, 20 June 2006 (UTC)

  • Support merge -- As long as the correct redirects are established, I'd support this merger. Atlant 16:31, 20 June 2006 (UTC)
  • Support merge -- Definitely; there is no point in having three separate articles for what is already a vague term that may cover all the articles together. Addps4cat 19:03, 14 September 2006 (UTC)

History...[edit]

A long time ago, I worked on an HC11 and I seem to remember the learned professor making a distinction between jump and branch (probably only for that architecture). Anyone else remember more?--66.93.220.66 04:28, 14 August 2007 (UTC)

I was thinking of the same thing ... Why look at unconditional jumps as branching ? In my opinion the program executes linearly (almost), there are not two possibilities - branches, especially on the today's pipelined hardware. Bytencoder 12:20, 8 October 2007 (UTC)
In some processors, there is a branch-always instruction. In other processors, jump is a "branch always" but the distinction is made in the mneumonics. In still other processors, branch instructions have a limited range while jump instructions have a much larger range and/or different addressing modes for the destination. — Val42 19:31, 8 October 2007 (UTC)
It's simple: The branch is the instuctions jumped to and executed as a result of a jump instruction.
I've seen some assembly languages where they're all called branches and others where they're all called jumps and others still where there's a mixture where the jump is unconditional and the branch is conditional, and others yet again where the jump means a long distance and branch is short distance. I think one can say that control flow always branches at a conditional jump or branch instruction, control flow doesn't jump. There is also a little nasty in that in some architectures the instruction after the jump or branch instruction is always executed because of pipelining. Also of course branch and link instructions don't at a high level correspond to any sort of branch in control flow but to a subroutine call, and return or exit instruction are also branches in machine terms.
Probably the article should just make a clear distinction between branch instructions and control flow branching or subroutine calling. Dmcq (talk) 12:28, 11 February 2011 (UTC)
Why make it so hard? Just follow the original language semantics instead of peculiar assembly mnemonics: What branch of code that should be executed at a particular point in a program is controlled by jumps at the machine level. The same kind of control is expressed as if condition then true-branch else false-branch, and similar, at higher levels. Whether a jump instruction is labeled "brcc dst" or "jmp nc,dst" is fairly irrelevant in that context.
Subroutine calling can be seen as another mechanism or as a special case or extension of this (which could well be mentioned). However, subroutines has it's own articles which explains the mechanics of call/ret instructions as well as branch and link instructions (and pipelines, if i remember correctly). 83.255.34.242 (talk) 03:42, 12 February 2011 (UTC)
We're supposed to follow what sources say, it is quite explicitly not a dictionary like wiktionary. That's why 'citation needed' is so important in Wikipedia. And that seems to be a problem with this article which might explain why this discussion is taking place. There are no citations. How about some computer science references that talk about branches, that would be a lot meore definitive than anything on tis talk page.Dmcq (talk) 10:52, 12 February 2011 (UTC)