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/>
3
File Created: Nov 2025
4
5
6
Licensed under the Apache License, Version 2.0 (the "License");
7
you may not use this file except in compliance with the License.
8
You may obtain a copy of the License in the accompanying file
9
Licence.txt or at
10
11
http://www.apache.org/licenses/LICENSE-2.0
12
13
Unless required by applicable law or agreed to in writing, software
14
distributed under the License is distributed on an "AS IS" BASIS,
15
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
See the License for the specific language governing permissions and
17
limitations 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
26
extern
"C"
27
{
28
#endif
29
31
WG14_RESULT_EXTERN
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
WG14_RESULT_INLINE
#define WG14_RESULT_INLINE
Definition
config.h:63
WG14_RESULT_EXTERN
#define WG14_RESULT_EXTERN
Definition
config.h:113
WG14_RESULT_SINGLETON
#define WG14_RESULT_SINGLETON
Definition
config.h:121
status_code_posix_domain
status_code_domain * status_code_posix_domain(void)
Retrieve the domain for status_code_posix
status_code_system.h
status_code_domain_s
The functions defined by a status code domain, kept ABI compatible with a C++ vtable.
Definition
status_code_domain.h:533
status_code_posix_s
A POSIX status code.
Definition
status_code_posix.h:37
status_code_posix_s::base
status_code_untyped base
Definition
status_code_posix.h:38
status_code_posix_s::value
int value
Definition
status_code_posix.h:39
status_code_system_s
A status_code guaranteed to be able to hold any system error code in full. The payload is always an i...
Definition
status_code_system.h:35
status_code_untyped
Type of an untyped status code.
Definition
status_code_domain.h:243
include
wg14_result
status_code_posix.h
Generated by
1.9.8