diff options
| author | Nathan V. Morrical <natemorrical@gmail.com> | 2024-01-17 15:34:51 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-17 15:34:51 -0800 |
| commit | 1a13842f7ece9f3c492a7017509b75eafa903bbf (patch) | |
| tree | 5d9eeccce9afa1695363737d1e2e966a1da47ba3 /docs | |
| parent | bf2e0fe7e28dff4613e816ad6fb1abdb522fc28a (diff) | |
updated docs to more clearly define differences in sizeof(bool) depending on the target platform (#3458)
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/user-guide/02-conventional-features.md | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/user-guide/02-conventional-features.md b/docs/user-guide/02-conventional-features.md index ebf4c1ca7..6c6198d90 100644 --- a/docs/user-guide/02-conventional-features.md +++ b/docs/user-guide/02-conventional-features.md @@ -54,7 +54,19 @@ All targets support the 32-bit `float`, but support for the other types depends ### Boolean Type -The type `bool` is used to represent Boolean truth value: `true` and `false`. +The type `bool` is used to represent Boolean truth value: `true` and `false`. + +For compatibility reasons, the `sizeof(bool)` depends on the target. + +| Target | sizeof(bool) | +|--------| ---------------------- | +| GLSL | 4 bytes / 32-bit value | +| HLSL | 4 bytes / 32-bit value | +| CUDA | 1 bytes / 8-bit value | + +> #### Note #### +> When storing bool types in structures, make sure to either pad host-side data structures accordingly, or store booleans as, eg, `uint8_t`, to guarantee +> consistency with the host language's boolean type. #### The Void Type |
