← Back to davo.co
aboutsummaryrefslogtreecommitdiffstats
path: root/shadow.c
diff options
context:
space:
mode:
authorDavid Faulkner <[email protected]>2026-08-07 23:40:47 -0500
committerDavid Faulkner <[email protected]>2026-08-07 23:40:47 -0500
commitb3e9e62599532050fc776c5e8f076915b56c2235 (patch)
treeaf252346106a61b18cc6fc6fdbd32e962d096f1c /shadow.c
Import official C23 code examples for Modern C (Jens Gustedt, 2024)HEADupstream-importmain
- Add official C source files, Makefile, c23-fallback.h, and LICENSE - Update README.md with study mirror notice
Diffstat (limited to 'shadow.c')
-rw-r--r--shadow.c20
1 files changed, 20 insertions, 0 deletions
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}*/
+ /*@…*/
+}