Re: [RFC] Generalizing default initializers and adding unsafe initializers

Message ID
DKIM signature
Download raw message
Im very excited to see this proposal!

> For example, it is often necessary to statically allocate
> variables whose initializers cannot be evaluated at compile-time,

Another case where ^this^ has been true for me is when initializing
global unstable (exported but undocumented) structs. I recently wrote
the following to interface with debug:: and debug::image:

def self: *image::image = &self_buf: *image::image;

let self_buf: [size(image::image)]u8 = [0...];

@init fn self() void = {
        *self = image::self()!;

> 1. Should it zero the underlying memory, or leave it undefined?

I think making `...!` should zero the memory, as I did manually above.

Reply to thread Export thread (mbox)