Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a22a160bddda122e

Jump to content

Talk:Branch table

Page contents not supported in other languages.
Add topic
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

Would an example of a specialized example be TMI?

[edit]

The IBM z/Architecture has a Branch Indirect on Condition (BIC) instruction that uses its 64 bit operand as a branch address. Would giving an example in § Example be TMI? -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 14:47, 17 February 2026 (UTC)Reply

I would strongly support an assembly-language example but not one that was too clever and introduced extraneous concepts. An assembly-language example would be helpful as it removes the higher-level semantics; it's what is actually executed by the processor. Right now there's a PIC example which is pretty fringe as the indirect action only works on the lower eight bits of PC. How about an X86 assembly example? RastaKins (talk) 15:51, 17 February 2026 (UTC)Reply
I have assembler experience with the mainframe line culminating in z/Architecture; My Intel experiences is limited to Ada, ooRexx, Perl and Rexx, no assembler, so someone else would have to do the Intell example. I'm willing to do the z example using BIC and using only older instructions, if that's not TMI. -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 17:31, 17 February 2026 (UTC)Reply