You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using nature 0.4.0-beta, I was messing around with structs.
I noticed that if this standalone function argh() has the print statement with "Made it this far!" before the declaration of r2, the program compiles and runs just fine. Remove or comment out that print statement and there's a segmentation fault during the execution of the function.
Similar things seem to happen when I leave out the r2 variable entirely, and just perform arithmetic directly on the passed rectangle r.
Maybe I'm misunderstanding the care and feeding of structs but this seems odd.
type rectangle = struct {
int width = 0
int length = 0
string name = ""
}
fn argh(rectangle r): rectangle {
r.width = 3
r.length = 4
println("Made it this far!")
var r2 = rectangle {
width = r.width * 2,
length = r.length * 2
}
println("Made it to here!")
return r2
}
The text was updated successfully, but these errors were encountered:
Using nature 0.4.0-beta, I was messing around with structs.
I noticed that if this standalone function
argh()
has the print statement with "Made it this far!" before the declaration of r2, the program compiles and runs just fine. Remove or comment out that print statement and there's a segmentation fault during the execution of the function.Similar things seem to happen when I leave out the
r2
variable entirely, and just perform arithmetic directly on the passed rectangler
.Maybe I'm misunderstanding the care and feeding of structs but this seems odd.
The text was updated successfully, but these errors were encountered: