From c39340194e89738a2ee7fac1bc1f169d90b743a3 Mon Sep 17 00:00:00 2001 From: olemorud Date: Tue, 6 Jun 2023 11:43:59 +0200 Subject: [PATCH] Add README --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..c9dcae2 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ + +# Namespaces in C + +In C you can create pseudo-namespaces by abusing structs of function +pointers, making function calls look like `module.func(x)` instead of +`func(x)`. + +A lot of people online spout that this creates overhead, but this should +show that clang>=15.0.7 will still inline such function calls. GCC 11.3.1 +is unable to inline the function, but will still call the function +directly. + +## Build +```sh +./build.sh +``` + +## Verify code +``` +./build/main +``` + +## Check disassembly +``` +less dump.asm +```