mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
0.5.5 Disallow multiple `_` in a row in digits, e.g. `1__000`. #1138. Fixed toposort example. Struct/union members now correctly rejects members without storage size #1147. `math::pow` will now correctly promote integer arguments. `math::pow` will now correctly promote integer arguments. Added `new_aligned` and `alloc_aligned` functions to prevent accidental under-alignment when allocating simd. Pointer difference would fail where alignment != size (structs etc) #1150. Add test that overalignment actually works for lists. Fixed array calculation for npot2 vectors. Use native aligned alloc on Windows and POSIX. Deprecates "offset". Simplification of the Allocator interface.
20 lines
252 B
Plaintext
20 lines
252 B
Plaintext
import std;
|
|
struct Foo
|
|
{
|
|
int a,b,c,d;
|
|
}
|
|
|
|
fn void pointer_diff() @test
|
|
{
|
|
Foo* foo;
|
|
isz offset = &foo[1] - &foo[0];
|
|
assert(offset == 1);
|
|
}
|
|
|
|
fn void pointer_add() @test
|
|
{
|
|
Foo* foo;
|
|
Foo* bar = foo + 2;
|
|
isz offset = bar - foo;
|
|
assert(offset == 2);
|
|
} |