From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/types.html | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 devdocs/c/types.html (limited to 'devdocs/c/types.html') diff --git a/devdocs/c/types.html b/devdocs/c/types.html new file mode 100644 index 00000000..7f02a985 --- /dev/null +++ b/devdocs/c/types.html @@ -0,0 +1,87 @@ +

Type support

See also type system overview and arithmetic types defined by the language.

+

Basic types

Additional basic types and convenience macros

+ + + + + + + + + + + + + + + + + + +
Defined in header <stddef.h>
unsigned integer type returned by the sizeof operator
(typedef)
signed integer type returned when subtracting two pointers
(typedef)
+
(C23)
the type of the predefined null pointer constant nullptr
(typedef)
implementation-defined null pointer constant
(macro constant)
+
(C11)
a type with alignment requirement as great as any other scalar type
(typedef)
byte offset from the beginning of a struct type to specified member
(function macro)
Defined in header <stdbool.h>
bool
+
(C99)(removed in C23)
convenience macro, expands to _Bool
(keyword macro)
true
+
(C99)(removed in C23)
expands to integer constant 1
(macro constant)
false
+
(C99)(removed in C23)
expands to integer constant 0
(macro constant)
__bool_true_false_are_defined
+
(C99)(deprecated in C23)
expands to integer constant 1
(macro constant)
Defined in header <stdalign.h>
alignas
+
(C11)(removed in C23)
convenience macro, expands to keyword _Alignas
(keyword macro)
alignof
+
(C11)(removed in C23)
convenience macro, expands to keyword _Alignof
(keyword macro)
__alignas_is_defined
+
(C11)(removed in C23)
expands to integer constant 1
(macro constant)
__alignof_is_defined
+
(C11)(removed in C23)
expands to integer constant 1
(macro constant)
Defined in header <stdnoreturn.h>
noreturn
+
(C11)(deprecated in C23)
convenience macro, expands to _Noreturn
(keyword macro)

Fixed width integer types (since C99) +

Numeric limits +

Notes

+ + + +

The type of true and false is int rather than _Bool.

+

A program may undefine and perhaps then redefine the macros bool, true and false. However, such ability is a deprecated feature.

+
+(since C99)
(until C23) +

The type of true and false is bool. It is unspecified whether any of bool, _Bool, true, or false is implemented as a predefined macro.

+

If bool, true, or false (but not _Bool) is defined as a predefined macro, a program may undefine and perhaps redefine it.

+
(since C23)

Example

#include <stdio.h>
+#include <stdbool.h>
+#include <stdalign.h>
+ 
+int main(void)
+{
+    printf("%d %d %d\n", true && false, true || false, !false);
+    printf("%d %d\n", true ^ true, true + true);
+    printf("%zu\n", alignof(short));
+}

Possible output:

+
0 1 1
+0 2
+2

References

See also

+
C++ documentation for Type support library
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/types +

+
-- cgit v1.2.3