spy v2.0.0
Denise Bloch
 
Loading...
Searching...
No Matches

◆ libc

constexpr auto spy::libc = libc_type {}
inlineconstexpr

LIBC version reporting value.

The spy::libc object can be compared to any other libc related value to verify if the code being compiled with a specific version of the libc.

Any libc related value can be checked for equality or ordering for a given version. The targeted version is then specified using a libc-dependent literal.

Additionally, any of the libc related value are convertible to bool. They evaluates to true if they matches the correct libc currently used.

Supported Value

Name Vendor
spy::cloudabi_ CloudABI
spy::uc_ uClibc
spy::vms_ VMS
spy::zos_ zOS
spy::gnu_ GNU

Example

#include <iostream>
#include <spy/spy.hpp>
int main()
{
// Comparisons
if constexpr(spy::libc == spy::gnu_) std::cout << "This code is compiled with the GNU libc.\n";
else if constexpr(spy::libc == spy::zos_)
std::cout << "This code is compiled with the zOS libc.\n";
else if constexpr(spy::libc == spy::vms_)
std::cout << "This code is compiled with the VMS libc.\n";
// Direct test
if constexpr(spy::gnu_) std::cout << "This code is compiled with the GNU libc.\n";
else if constexpr(spy::zos_) std::cout << "This code is compiled with the zOS libc.\n";
else if constexpr(spy::vms_) std::cout << "This code is compiled with the VMS libc.\n";
}
constexpr auto libc
LIBC version reporting value.
Definition libc.hpp:130