Constant struct fields in Zig
Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows
and columns
fields will never change (and maybe this should be true for data
too). However, my understanding is that Zig will only allow constant struct members if they are comptime
. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?
Constant struct fields in Zig
Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows
and columns
fields will never change (and maybe this should be true for data
too). However, my understanding is that Zig will only allow constant struct members if they are comptime
. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?
Constant struct fields in Zig
Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows
and columns
fields will never change (and maybe this should be true for data
too). However, my understanding is that Zig will only allow constant struct members if they are comptime
. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?
Constant struct fields in Zig
Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows
and columns
fields will never change (and maybe this should be true for data
too). However, my understanding is that Zig will only allow constant struct members if they are comptime
. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?
Constant struct fields in Zig
Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows
and columns
fields will never change (and maybe this should be true for data
too). However, my understanding is that Zig will only allow constant struct members if they are comptime
. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?
Constant struct fields in Zig
Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows
and columns
fields will never change (and maybe this should be true for data
too). However, my understanding is that Zig will only allow constant struct members if they are comptime
. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?
Constant struct fields in Zig
Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows
and columns
fields will never change (and maybe this should be true for data
too). However, my understanding is that Zig will only allow constant struct members if they are comptime
. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?
Constant struct fields in Zig
Dabbling with Zig and have a question about const fields in structs. In the simple struct below I have started to implement a simple matrix data structure. Presumably once I have instantiated a Matrix, the rows
and columns
fields will never change (and maybe this should be true for data
too). However, my understanding is that Zig will only allow constant struct members if they are comptime
. But there are many cases where the dimensions of my matrix will only be known at runtime (e.g. reading the data from a file) but should remain constant thereafter. Is there any way to enforce constness of the struct members?
Global and static local variables initialization
I’m trying to learn Zig v0.13.0, and I’m playing around with small programs. While playing, I tried to create a “global allocator”, which is more convenient for now.
Global and static local variables initialization
I’m trying to learn Zig v0.13.0, and I’m playing around with small programs. While playing, I tried to create a “global allocator”, which is more convenient for now.