≈ the.bay.news

Cannot delete a variable in a macro

Julia Programming Language
Cannot delete a variable in a macro
I want to simulate a allocation system trough the two followings functions alloc_float(n) = unsafe_wrap(Array, convert(Ptr{Float64},Libc.calloc(n, 8)), n) macro free(p) :(Libc.free(pointer($p)); p = nothing) # does not work with $p = nothing end If I used the 2 functions julia> w = alloc_float(3) 3-element Vector{Float64}: 0.0 0.0 0.0 julia> @free w julia> w 3-element Vector{Float64}: 2.86883399e-315 2.90896374e-315 1.6e-322 the w still remains in the Main space variable even if ...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.