mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix stack setting after error return. Some fixes to examples.
This commit is contained in:
committed by
Christoffer Lerno
parent
b1d83e2ccd
commit
bb28f6e61c
20
resources/examples/swap.c3
Normal file
20
resources/examples/swap.c3
Normal file
@@ -0,0 +1,20 @@
|
||||
module test;
|
||||
import libc;
|
||||
|
||||
/**
|
||||
* @checked a = b, b = a
|
||||
*/
|
||||
macro void @swap(&a, &b)
|
||||
{
|
||||
$typeof(a) temp = a;
|
||||
a = b;
|
||||
b = temp;
|
||||
}
|
||||
|
||||
fn void main()
|
||||
{
|
||||
int x = 123;
|
||||
int y = 456;
|
||||
@swap(x, y);
|
||||
libc::printf("x: %d y: %d\n", x, y);
|
||||
}
|
||||
Reference in New Issue
Block a user