mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-21 00:46:47 +00:00
Default struct member reordering for minimal size
Rule: largest members to smallest; if same size, order in source order
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ print_string_to_buffer :: proc(buf: ^[]byte, s: string) {
|
||||
// NOTE(bill): This is quite a hack
|
||||
// TODO(bill): Should I allow the raw editing of a slice by exposing its
|
||||
// internal members?
|
||||
Raw_Bytes :: struct {
|
||||
Raw_Bytes :: struct #ordered {
|
||||
data: ^byte
|
||||
len: int
|
||||
cap: int
|
||||
|
||||
+3
-2
@@ -1,13 +1,14 @@
|
||||
#load "basic.odin"
|
||||
|
||||
main :: proc() {
|
||||
Vector3 :: struct {
|
||||
Vector4 :: struct {
|
||||
x: i8
|
||||
y: i32
|
||||
z: i16
|
||||
w: i16
|
||||
}
|
||||
|
||||
v := Vector3{1, 4, 9}
|
||||
v := Vector4{1, 4, 9, 16}
|
||||
|
||||
t := type_info(v)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user