c3c icon indicating copy to clipboard operation
c3c copied to clipboard

@align Doesn't Align All Fields For Single-Line Declarations

Open Ked29 opened this issue 1 year ago • 3 comments

After playing around with the language, I wanted to see if it supported the alignment of structs and or fields of said structs. I tried to do this, for example:

struct Vector3
{
     float x, y, z @align(8);
}

However, that only aligns z to 8 bytes.

It does work if you do something like this:

struct Vector3
{
     float x @align(8);
     float y @align(8);
     float z @align(8);
}

Or something like this:

struct Vector3
{
     float x @align(8), y @align(8), z @align(8);
}

It isn't a make-or-break for me, but having that simple QoL feature is quite nice.

Ked29 avatar Jul 29 '24 15:07 Ked29

This is actually a bug. You can try declaring globals in the same way and they all get the same alignment as expected.

lerno avatar Jul 30 '24 00:07 lerno

This should be fixed in master and will appear in the next build.

lerno avatar Jul 30 '24 00:07 lerno

Awesome. Thank you for your hard work, I'm very excited to see the growth of this language.

Ked29 avatar Jul 30 '24 00:07 Ked29