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 --- tendots.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tendots.c (limited to 'tendots.c') diff --git a/tendots.c b/tendots.c new file mode 100644 index 0000000..0733747 --- /dev/null +++ b/tendots.c @@ -0,0 +1,25 @@ +#include + +/* delay execution with some crude code, + should use thrd_sleep, once we have that */ +void delay(double secs) { + double const magic = 4E8; // works just on my machine + unsigned long long const nano = secs * magic; + for (unsigned long volatile count = 0; + count < nano; + ++count) { + /* nothing here */ + } +} + +int main(int argc, [[maybe_unused]] char* argv[argc+1]) { + fputs("waiting 10 seconds for you to stop me", stdout); + if (argc < 3) fflush(stdout); + for (unsigned i = 0; i < 10; ++i) { + fputc('.', stdout); + if (argc < 2) fflush(stdout); + delay(1.0); + } + fputs("\n", stdout); + fputs("You did ignore me, so bye bye\n", stdout); +} -- cgit v1.2.3