core.internal.switch_ - D Programming Language

Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Community Discord
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# core.internal.switch_

This module contains compiler support for switch...case statements
License:
Distributed under the Boost Software License 1.0. (See accompanying file LICENSE)

Source core/internal/switch_.d

pure nothrow @nogc @safe int `__switch`(T, caseLabels...)(scope const T[] `condition`);
  Support for switch statements switching on strings.
  Parameters:

  caseLabels | sorted array of strings generated by compiler. Note the strings are sorted by length first, and then lexicographically.
  T[] `condition` | string to look up in table

  Returns:
  index of match in caseLabels, a negative integer if not found
void `__switch_error`()(string `file` = __FILE__, size_t `line` = __LINE__);
  Compiler lowers final switch default case to this (which is a runtime error) Old implementation is in core/exception.d

Copyright © 1999-2021 by the D Language Foundation | Page generated by Ddoc on Tue Jul 13 07:53:58 2021