Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack overflow in Nightly 0.3 #6147

Closed
magistere opened this issue Mar 13, 2014 · 7 comments
Closed

Stack overflow in Nightly 0.3 #6147

magistere opened this issue Mar 13, 2014 · 7 comments

Comments

@magistere
Copy link
Contributor

I'm getting stack overflow in latest Windows nightly (Version 0.3.0-prerelease+1864 (2014-03-06 05:43 UTC)):

immutable Pixel
  r::Uint8
  g::Uint8
  b::Uint8
end

Pixel(r,g,b) = Pixel(uint8(r),uint8(g),uint8(b))

function change(a)
  a[3,4] = Pixel(1,2,3)
end

a = Array(Pixel,10,10)
change(a)

Julia output:

Warning: redefining constant CPU_CORES
ERROR: stack overflow
while loading R:\Julia\so.jl, in expression starting on line 14
@ivarne
Copy link
Member

ivarne commented Mar 13, 2014

This is because you do not need the extra constructor anymore. Ref: #4026

@magistere
Copy link
Contributor Author

Thanks for answer. But then it will not work in Julia 0.2. Is there any simple way to determine Julia version programmatically?

@ivarne
Copy link
Member

ivarne commented Mar 16, 2014

if VERSION.major == 0 && VERSION.minor == 2
    Pixel(r,g,b) = Pixel(uint8(r),uint8(g),uint8(b))
end

@IainNZ
Copy link
Member

IainNZ commented Mar 16, 2014

@magistere
Copy link
Contributor Author

Such obvious name :) Thanks, Ivar, Iain.

@carlobaldassi
Copy link
Member

Extra tip: versions are more easily and correctly compared like this:

VERSION < v"0.3-"

The - at the end means that this will exclude all pre-release versions of 0.3. To get all 0.2 versions, including pre-releases:

v"0.2-" <= VERSION < v"0.3-"

To get only stable 0.2 versions:

v"0.2" <= VERSION < v"0.3-"

Note that v"0.2" is equivalent to v"0.2.0".
At least version 0.2.1:

VERSION >= v"0.2.1"

and so on.

@magistere
Copy link
Contributor Author

Thanks Carlo, your answer deserve to be mentioned in documentation. Maybe on FAQ?

jiahao added a commit that referenced this issue Mar 23, 2014
jiahao added a commit that referenced this issue Mar 23, 2014
jiahao added a commit that referenced this issue Mar 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants