Skip to content

Commit

Permalink
More fixes of the macro texts.
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Dec 31, 2024
1 parent b22de93 commit 9f63c48
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/content/docs/Generic Programming/macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ description: Macros
sidebar:
order: 83
---
The macro capabilities of C3 reaches across several constructs: macros (prefixed with `@` at invocation), [generic functions, generic modules](/generic-programming/generics/), and [compile time variables](/generic-programming/compiletime/#compile-time-values) (prefixed with `$`), macro compile time execution (using `$if`, `$for`, `$foreach`, `$switch`) and attributes.
The macro capabilities of C3 reaches across several constructs:
macros, [generic functions, generic modules](/generic-programming/generics/), and [compile time variables](/generic-programming/compiletime/#compile-time-values) (prefixed with `$`), macro compile time execution (using `$if`, `$for`, `$foreach`, `$switch`) and attributes.

## A quick comparison of C and C3 macros

Expand Down Expand Up @@ -205,7 +206,7 @@ disable declarations. This makes the code easier to read, but at the cost of exp
A macro is defined using `macro <name>(<parameters>)`. All user defined macros use the @ symbol if they use the `&` or `#` parameters.
The parameters have different sigils: `$` means compile time evaluated (constant expression or type). `#` indicates an expression that is not yet evaluated, but is bound to where it was defined. Finally `&` is used to *implicitly* pass a parameter by reference.
`@` is required on macros that use `#` and `&` parameters.
`@` is required on macros that use `#` and `&` parameters or trailing macro bodies.
A basic swap:
Expand Down

0 comments on commit 9f63c48

Please sign in to comment.