WG14 result
Loading...
Searching...
No Matches
status_code_posix.h
Go to the documentation of this file.
1/* Proposed WG14 Result
2(C) 2024 - 2026 Niall Douglas <http://www.nedproductions.biz/>
3File Created: Nov 2025
4
5
6Licensed under the Apache License, Version 2.0 (the "License");
7you may not use this file except in compliance with the License.
8You may obtain a copy of the License in the accompanying file
9Licence.txt or at
10
11http://www.apache.org/licenses/LICENSE-2.0
12
13Unless required by applicable law or agreed to in writing, software
14distributed under the License is distributed on an "AS IS" BASIS,
15WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16See the License for the specific language governing permissions and
17limitations under the License.
18*/
19
20#ifndef WG14_RESULT_STATUS_CODE_POSIX_H
21#define WG14_RESULT_STATUS_CODE_POSIX_H
22
23#include "status_code_system.h"
24
25#ifdef __cplusplus
26extern "C"
27{
28#endif
29
32 WG14_RESULT_SINGLETON WG14_RESULT_PREFIX(status_code_domain) *
33 WG14_RESULT_PREFIX(status_code_posix_domain)(void);
34
36 typedef struct WG14_RESULT_PREFIX(status_code_posix_s)
37 {
38 WG14_RESULT_PREFIX(status_code_untyped) base;
39 int value;
40 } WG14_RESULT_PREFIX(status_code_posix);
41#if __STDC_VERSION__ >= 201100L
42 _Static_assert(sizeof(WG14_RESULT_PREFIX(status_code_posix)) <=
43 sizeof(WG14_RESULT_PREFIX(status_code_system)),
44 "A POSIX status code is too large for status_code_system!");
45 _Static_assert(
46 __alignof(WG14_RESULT_PREFIX(status_code_posix)) <=
47 __alignof(WG14_RESULT_PREFIX(status_code_system)),
48 "A POSIX status code is too over aligned for status_code_system!");
49#endif
50
52 WG14_RESULT_INLINE WG14_RESULT_PREFIX(status_code_posix)
53 WG14_RESULT_PREFIX(status_code_posix_make)(int val)
54 {
55 const WG14_RESULT_PREFIX(status_code_posix)
56 ret = {{WG14_RESULT_PREFIX(status_code_posix_domain)()}, val};
57 return ret;
58 }
59
60#ifdef __cplusplus
61}
62#endif
63
64#if WG14_RESULT_ENABLE_HEADER_ONLY
65#include "../../src/wg14_result/status_code_posix.c"
66#endif
67
68#endif
#define WG14_RESULT_INLINE
Definition config.h:63
#define WG14_RESULT_EXTERN
Definition config.h:113
#define WG14_RESULT_SINGLETON
Definition config.h:121
status_code_domain * status_code_posix_domain(void)
Retrieve the domain for status_code_posix
The functions defined by a status code domain, kept ABI compatible with a C++ vtable.
A POSIX status code.
status_code_untyped base
A status_code guaranteed to be able to hold any system error code in full. The payload is always an i...
Type of an untyped status code.