51
deleted
int volatile x = 10;
Foo const foo = { ... };
int * const y = &x;
// or
volatile int x = 10;
const Foo foo = { ... };
int const* y = &x;
int* volatile x = 10; // volatile pointer to int
Foo* const foo = { ... }; // const pointer to Foo
Foo const* foo = { ... }; // pointer to const Foo
int* const y = &x; // const pointer to int
int const* y = &x; // pointer to const int
int volatile* x = 10; // volatile pointer to int
Foo const* foo = { ... }; // const pointer to Foo
const Foo* foo = { ... }; // pointer to const Foo
int const* y = &x; // const pointer to int
const int* y = &x; // pointer to const int
volatile (int*) x = 10; // volatile pointer to int
const (Foo*) foo = { ... }; // const pointer to Foo
(const Foo)* foo = { ... }; // pointer to const Foo
const (int*) y = &x; // const pointer to int
(const int)* y = &x; // pointer to const int
module vector (A, B, C); // A, B, C are generic parameters.
type Foo struct {
A a;
}
func C test(B b, Foo *foo) {
return a + b;
}
import vector(f64, f32, i32) as generic_tests;
func f64 test()
{
generic_tests.Foo foo = { 2.0 };
return generic_tests.test(3.0, foo);
module vector (A, B, C);
contract(A a, B b, C c) {
a + b; // Only expressions allowed
c == a + b; // Only expressions allowed
}
... code ...
import vector(struct Bar, f32, i32) as gen_test;
// This would give the error
---> Illegal arguments for generic module vector, breaks contract 'struct Bar' == 'f32' + 'i32'
switch (x) {
case 1 .. 10:
...
case 11 .. 100:
...
}
switch (x) {
case x > 200: return 0;
case x < 2:
small_x_warning();
break;
case 0:
....
case x > y && a < 1:
...
}