HIBF 1.0.0-rc.1
Loading...
Searching...
No Matches
unreachable.hpp File Reference

Provides seqan::hibf::unreachable. More...

#include <cassert>
#include <utility>
#include <hibf/platform.hpp>
+ Include dependency graph for unreachable.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void seqan::hibf::unreachable ()
 Marks unreachable code paths.
 

Detailed Description

Provides seqan::hibf::unreachable.

Author
Enrico Seiler <enrico.seiler AT fu-berlin.de>

Function Documentation

◆ unreachable()

void seqan::hibf::unreachable ( )
inline

Marks unreachable code paths.

Mode (NDEBUG defined ?) Behavior
Debug (No) assert(false)
Release (Yes) std::unreachable()

Example

// SPDX-FileCopyrightText: 2006-2026, Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2026, Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
#include <hibf/misc/unreachable.hpp> // for unreachable
int foo(int const i)
{
// The compiler will not generate the default branch.
// Note that an input of any `i` other than `0` and `1` is undefined behavior!
switch (i)
{
case 0:
return -5;
case 1:
return 3;
default:
seqan::hibf::unreachable();
}
}
Provides seqan::hibf::unreachable.