3 ms·
That would require having constructors, which is not something Odin will ever have nor should it. However you can just initialize with a constant or variable or
by gingerBill 1y ago
That would require having constructors, which is not something Odin will ever have nor should it. However you can just initialize with a constant or variable or just use a procedure to initialize with. Odin is a C alternative after all, so it's a fully imperative procedural language.
- Rusky 1y agoWhy would it require constructors? As opposed to simply enforcing that it always be initialized with a constant/variable/procedure/etc rather than zeroed.
- fc417fc802 1y ago> you can just initialize with a constant or variable or just use a procedure to initialize with. Is there an option to leave something uninitialized? I often find the allocation of explicitly uninitialized objects to be a performance necessity in tight loops when I'm working with numpy.
- O-stevns 1y agoYes, as mentioned here on the overview: https://odin-lang.org/docs/overview/#built-in-constants-values-and-procedures https://odin-lang.org/docs/overview/#built-in-constants-valu... x: int // initialized with its zero value y: int = --- // uses uninitialized memory