summaryrefslogtreecommitdiffhomepage
path: root/DESIGN.md
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-25 00:30:44 -0600
committerSean Kurtz <seankurtz75@gmail.com>2026-11-25 00:30:44 -0600
commit5f92e02ff71be19067a422d324beb610cacd084d (patch)
tree1af510b0e4b9e3de95b18f476a6ebff2f109c488 /DESIGN.md
parent7a7320b6a0d7dd6864b708b7e74fb5032a5bdf8e (diff)
downloadzash-chore/c23-nullptr-constexpr.tar.gz
C23: nullptr for null pointers, constexpr for typed constantschore/c23-nullptr-constexpr
nullptr in every place a null pointer constant was meant; NULL is gone from src/. constexpr where it improves on #define without costing anything: the IGGCSI00 work-area offsets and sizes, and the scalar sizes MVS_DSN_MAX, CSI_FIELD_LEN, CSI_WORK_MIN, PDS_DIRBLK, CSI_WORK, CSI_MAX_CALLS. A constexpr in C is a constant expression, so it still bounds the arrays that use it, and it now carries a type and can be checked with static_assert. Feature switches (#if), the CSIETYPE/EBCDIC byte constants read as octets, and the related-constant enum sets stay as they were.
Diffstat (limited to 'DESIGN.md')
-rw-r--r--DESIGN.md11
1 files changed, 9 insertions, 2 deletions
diff --git a/DESIGN.md b/DESIGN.md
index 0c092aa..2a57220 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -74,8 +74,15 @@ creation and character encoding.
`[[fallthrough]]` in a `switch`. Two more, `UNREACHABLE()` and
`PRINTFLIKE` for format checking, remain macros in `shell.h` because
the standard has no spelling for them yet.
-- Constants are `#define`s with a typed value, or anonymous `enum`s for
- sets of related integer constants.
+- Constants are `constexpr` where a typed constant is better: the
+ IGGCSI00 work-area offsets and sizes, `MVS_DSN_MAX`, `CSI_WORK`,
+ `PDS_DIRBLK`. A `constexpr` in C is a constant expression, so it can
+ still bound an array (`unsigned char work[CSI_WORK]`), give a type to
+ a value, and be checked with `static_assert`. Feature switches that
+ `#if` reads, and sets of related integer constants, stay macros and
+ anonymous `enum`s: `#if` cannot see a `constexpr`.
+- `nullptr` everywhere a null pointer constant is meant; `NULL` is not
+ used.
- Warnings: `-Wall -Wextra -Wshadow -Wstrict-prototypes
-Wmissing-prototypes -Wconversion`, and the tree stays warning-free.