Jump to content

Talk:Branch table

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Return statements in PIC code example

[edit]

In the absence of call statements, those return statements look out of place. I could see goto statements that branch to a common point for resuming execution after the branches, but since the jump table relies on gotos it doesn't require returns. 198.82.9.165 (talk) 20:13, 28 June 2010 (UTC)[reply]

The way you ask this (incompletely phrased) question, makes it seem like you assume the reader can read your mind. What exactly are you talking about? Spell it out. — Preceding unsigned comment added by 82.9.176.129 (talk) 12:53, 3 September 2013 (UTC)[reply]

Jump table vs. branch table

[edit]

The top of the page implies that they are the same thing, however, the section "Jump table example in C" implies that they are different ("Another simple example, this time demonstrating a jump table rather than a mere branch table"). So what is the difference? Bayle Shanks (talk) 01:55, 7 July 2015 (UTC)[reply]

Other uses of technique

[edit]

The text of § Other uses of technique actually describes a special case rather than an alternate use. A branch to one leg of a case statement is a transfer of control. -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 12:46, 24 July 2024 (UTC)[reply]

Memory Safety in C Code Example

[edit]

The C code example grabs the argv, transforms it into an integer, and attempts to cap it between 0-3 to call a series of functions in the jump table.

Unfortunately this may fail and return undefined behaviour if the atoi result is a negative number, which would kick the array out of bounds and call an arbitrary function not in the jump table.

Should the example be fixed in order to not be memory unsafe? Although it shows the correct behaviour of a jump table it's really poor safety code. 62.133.21.170 (talk) 09:37, 21 August 2024 (UTC)[reply]