Skip to content

Commit

Permalink
Add news, test, doc
Browse files Browse the repository at this point in the history
  • Loading branch information
malmaud committed Feb 4, 2019
1 parent 66e26ab commit b608e11
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
13 changes: 13 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ New library functions
Standard library changes
------------------------

* A no-argument construct to `Ptr{T}` has been added which constructs a null pointer ([#30919])

#### LinearAlgebra

* Added keyword arguments `rtol`, `atol` to `pinv` and `nullspace` ([#29998]).
Expand Down Expand Up @@ -65,8 +67,19 @@ Deprecated or removed


<!--- generated by NEWS-update.jl: -->
[#24980]: https://github.com/JuliaLang/julia/issues/24980
[#29998]: https://github.com/JuliaLang/julia/issues/29998
[#30061]: https://github.com/JuliaLang/julia/issues/30061
[#30200]: https://github.com/JuliaLang/julia/issues/30200
[#30298]: https://github.com/JuliaLang/julia/issues/30298
[#30323]: https://github.com/JuliaLang/julia/issues/30323
[#30349]: https://github.com/JuliaLang/julia/issues/30349
[#30372]: https://github.com/JuliaLang/julia/issues/30372
[#30583]: https://github.com/JuliaLang/julia/issues/30583
[#30584]: https://github.com/JuliaLang/julia/issues/30584
[#30593]: https://github.com/JuliaLang/julia/issues/30593
[#30618]: https://github.com/JuliaLang/julia/issues/30618
[#30670]: https://github.com/JuliaLang/julia/issues/30670
[#30712]: https://github.com/JuliaLang/julia/issues/30712
[#30724]: https://github.com/JuliaLang/julia/issues/30724
[#30919]: https://github.com/JuliaLang/julia/issues/30919
1 change: 0 additions & 1 deletion base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,6 @@ Int64(x::Ptr) = Int64(UInt32(x))
UInt64(x::Ptr) = UInt64(UInt32(x))
end
Ptr{T}(x::Union{Int,UInt,Ptr}) where {T} = bitcast(Ptr{T}, x)
Ptr{T}() where {T} = Ptr{T}(C_NULL)

Signed(x::UInt8) = Int8(x)
Unsigned(x::Int8) = UInt8(x)
Expand Down
7 changes: 7 additions & 0 deletions base/pointer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ memory is actually valid, or that it actually represents data of the specified t
"""
Ptr

"""
Ptr{T}()
Creates a null pointer to type `T`.
"""
Ptr{T}() where {T} = Ptr{T}(C_NULL)

## converting pointers to an appropriate unsigned ##

"""
Expand Down
3 changes: 3 additions & 0 deletions test/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -730,3 +730,6 @@ end
@test isless(b, a)
@test sort([a, b]) == [b, a]
end

# Pointer 0-arg constructor
@test Ptr{Cvoid}() == C_NULL

0 comments on commit b608e11

Please sign in to comment.