Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. An analog switch, but more efficient

An analog switch, but more efficient

Scheduled Pinned Locked Moved C / C++ / MFC
databasedata-structureshelplearning
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vladimi_r2
    wrote on last edited by
    #1

    As is well known when using switch (expression), thus: "The expression must be of an integral type or of a class type for which there is an unambiguous conversion to integral type". If the switch contains a number of case / 2 to 4 /, then there is no problem. Well, if you say case is 30 pieces, then dostura to 29 in a row case, the compiler must make 29 comparisons. Below is a one of the solutions to this problem. And so the program as expression must transmit the index number to any array, containing the address points transition operator goto. Everything! Notes: Of course array must contain the called function.

    J 1 Reply Last reply
    0
    • V Vladimi_r2

      As is well known when using switch (expression), thus: "The expression must be of an integral type or of a class type for which there is an unambiguous conversion to integral type". If the switch contains a number of case / 2 to 4 /, then there is no problem. Well, if you say case is 30 pieces, then dostura to 29 in a row case, the compiler must make 29 comparisons. Below is a one of the solutions to this problem. And so the program as expression must transmit the index number to any array, containing the address points transition operator goto. Everything! Notes: Of course array must contain the called function.

      J Online
      J Online
      jeron1
      wrote on last edited by
      #2

      Have a gander here[^]. Pay particular attention to #11.

      "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups