From b3e9e62599532050fc776c5e8f076915b56c2235 Mon Sep 17 00:00:00 2001 From: David Faulkner Date: Fri, 7 Aug 2026 23:40:47 -0500 Subject: Import official C23 code examples for Modern C (Jens Gustedt, 2024) - Add official C source files, Makefile, c23-fallback.h, and LICENSE - Update README.md with study mirror notice --- shadow.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 shadow.c (limited to 'shadow.c') diff --git a/shadow.c b/shadow.c new file mode 100644 index 0000000..f996fc8 --- /dev/null +++ b/shadow.c @@ -0,0 +1,20 @@ +#include "c23-fallback.h" + +void squareIt(double* p) [[__unsequenced__]] { + *p *= *p; +} +int main(void) { + double x = 35.0; /*@\label{line:decl-x}*/ + double* xp = &x; /*@\label{line:decl-xp}*/ + { + squareIt(&x); /* Refers to double x *//*@\label{line:use-x-1}*/ + /*@…*/ + [[maybe_unused]] int x = 0; /* Shadow double x *//*@\label{line:decl-x-2}*/ + /*@…*/ + squareIt(xp); /* Valid use of double x *//*@\label{line:use-xp}*/ + /*@…*/ + } /*@\label{line:end-x-2}*/ + /*@…*/ + squareIt(&x); /* Refers to double x *//*@\label{line:use-x-2}*/ + /*@…*/ +} -- cgit v1.2.3