Hi,

Just wanted further help or clarification on assigning to array of 
user-defined structure.

Question was asked on Stack Overflow  ( *Uninitialized arrays in Julia* 
<http://stackoverflow.com/questions/24416925/uninitialized-arrays-in-julia>
 )

type struct
  u::Int64
  v::Int64
end

X = Array(struct, 100)
X[10].u = 3

will generate this error


One answer states:

You can assign values to uninitialized locations in arrays. You just can't 
extract values from uninitialized locations.

 

However when I run this code (Julia v0.3.0), I get an error:

ERROR: access to undefined reference
 in getindex at array.jl:246

I thought "X[10].u = 3" is assigning, not extracting? So why the error?

Thanks, Greg



Reply via email to