Re: Assigned gotos in standard C



"Adam" <adam.antonik@xxxxxxxxx> wrote in message news:9bfcd7c7-0821-4412-b22e-7380ccb8bbf2@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I understand that a switch statement would allow this sort of flow
control; however, will this not lead to each jump requiring linear
time to compute, as the code works its way through each case?

No. If the case values span a limited range (eg. 0 to 255, with or without gaps), then a jumptable is likely used. This is very fast.

The overheads of a switch are testing the index is in range, and jumping back to the start of the switch.

--
Bartc

.



Relevant Pages

  • Re: sparking/electrical problem with Peco points
    ... compromise your operation in order to keep locos away from each other. ... What I then said was that without an isolating section, ... is compromised by the control system. ... on/off using a switch on a control panel. ...
    (uk.rec.models.rail)
  • Re: Hardince HC Chucker -- someone needs help
    ... the bottom of the control box. ... Keep the coolant switch and wire the VFDs aux output to the ... Hardinge parts are available..usually..from Hardinge or scrap ... NRA LOH & Patron Member, Golden Eagle, Patriot's Medal. ...
    (rec.crafts.metalworking)
  • Re: Speech recognition system for Home automation.
    ... simply map to the hard switches, for dual voice/finger control. ... self contained in a voice chip, ... button keypad would need room for 40 voice commands (5 per switch) ... And as much as I like INSTEON (and use it, ...
    (comp.home.automation)
  • Re: [alsa-devel] [PATCH] ASoC: Add new TI TLV320AIC3204 CODEC driver
    ... I can't help but think that this'd be more legible with switch ... already tight for displaying register dumps via debugfs, ... I suspect that fixing the control may break what you're doing here? ... so is the DAC audio path routing. ...
    (Linux-Kernel)
  • Re: Useless UK police get their just deserts.
    ... The remote control in question would be one that controls a 3-pin ... I want to switch a small water pump on and off via the PC. ... buy a remotely controlled 13 amp socket, ... But that comes with its own remote control, as for a TV or VHS. ...
    (uk.legal)