c2compiler icon indicating copy to clipboard operation
c2compiler copied to clipboard

embed binary files length incorrect

Open bvdberg opened this issue 6 months ago • 1 comments

The last byte of a binary embed (const u8[]) is set to 0. This comes from the fact that it is stored inside a string literal inside the AST, since this is the most efficient way of storing it. Adding a new AST Element type seems like overkill.

bvdberg avatar Aug 05 '25 18:08 bvdberg

It seems this bug was fixed.

On the other hand, I think it should be OK to embed files into arrays of i8, non const arrays, and arrays longer than the file itself, just like strings can be used as initializers for these.

chqrlie avatar Aug 06 '25 15:08 chqrlie