From d8afa73368cdff38125fa1f7d17ad5ce54c84def Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 6 Apr 2025 21:43:19 -0400 Subject: Improved inline C code: now uses `C_code` keyword and supports interpolation with @ --- docs/c-interoperability.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'docs/c-interoperability.md') 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 -- cgit v1.2.3