Feb 9, 2021

[Go] Continuous memory allocation

Reference: allocate Nodes together with Name/Param/Func


Continuous memory allocation is always a thing.

Go example:

var x struct {
    n Node
    m Name
    p Param
}
n := &x.n
n.Name = &x.m
n.Name.Param = &x.p

instead of writing:
n := &Node {
    Name: &Name {
        Param: &Param{},
    }}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.