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.



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. ...
  • 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. ...
  • 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, ...
  • 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. ...
  • Re: Power Button on PWS
    ... > conclude anything from that ther were 6 with a carbon choke on them. ... and it's hard to achieve that with a hard-wired power switch. ... logic for the power control (manual switch, wake-on-LAN, wake-on-modem, ...