mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Deprecated '&' macro arguments.
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
module test;
|
||||
import libc;
|
||||
import std::io;
|
||||
|
||||
<*
|
||||
@require values::@assign_to(*b, *a) && values::@assign_to(*a, *b)
|
||||
@require $defined(#a = #b, #b = #a)
|
||||
*>
|
||||
macro void @swap(&a, &b)
|
||||
macro void @swap(#a, #b)
|
||||
{
|
||||
var temp = *a;
|
||||
*a = *b;
|
||||
*b = temp;
|
||||
var temp = #a;
|
||||
#a = #b;
|
||||
#b = temp;
|
||||
}
|
||||
|
||||
fn void main()
|
||||
@@ -16,5 +16,5 @@ fn void main()
|
||||
int x = 123;
|
||||
int y = 456;
|
||||
@swap(x, y);
|
||||
libc::printf("x: %d y: %d\n", x, y);
|
||||
io::printfn("x: %d y: %d", x, y);
|
||||
}
|
||||
Reference in New Issue
Block a user