aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-06 21:43:19 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-06 21:43:19 -0400
commitd8afa73368cdff38125fa1f7d17ad5ce54c84def (patch)
treeac4e54673da6ac32df1e351b913b7c1ddd1118b9 /docs
parentf4020db2f0d772481ba71edf78fbb65575badc00 (diff)
Improved inline C code: now uses `C_code` keyword and supports
interpolation with @
Diffstat (limited to 'docs')
-rw-r--r--docs/c-interoperability.md8
1 files changed, 3 insertions, 5 deletions
diff --git a/docs/c-interoperability.md b/docs/c-interoperability.md
index 3c5bbff1..3c0906ee 100644
--- a/docs/c-interoperability.md
+++ b/docs/c-interoperability.md
@@ -16,21 +16,19 @@ from inside a Tomo source file.
## Inline C Code
-As a final escape hatch, you can use `inline C` to add code that will be put,
+As a final escape hatch, you can use `C_code` to add code that will be put,
verbatim in the transpiled C code generated by Tomo. There are two forms: one
that creates an expression value and one that creates a block that is executed
without evaluating to anything:
```tomo
# Inline C block:
-inline C {
+C_code {
printf("This is just a block that is executed without a return value\n");
}
# Inline C expression (you must specify a type)
-val := inline C : Int32 {
- int x = 1; x + 1
-}
+val := C_code : Int32 (int x = 1; x + 1)
```
Inline C expressions must specify a type and they can be [compound statement