Skip to content

Commit

Permalink
Merge pull request #30919 from JuliaLang/ptr_init
Browse files Browse the repository at this point in the history
No-arg Ptr constructor.
  • Loading branch information
malmaud committed Feb 16, 2019
2 parents a44b421 + 6e87328 commit 28c3dd0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Standard library changes
* `hasmethod` can now check for matching keyword argument names ([#30712]).
* `startswith` and `endswith` now accept a `Regex` for the second argument ([#29790]).
* `retry` supports arbitrary callable objects ([#30382]).
* A no-argument construct to `Ptr{T}` has been added which constructs a null pointer ([#30919])

#### LinearAlgebra

Expand Down Expand Up @@ -79,6 +80,7 @@ Deprecated or removed
[#21598]: https://github.com/JuliaLang/julia/issues/21598
[#24980]: https://github.com/JuliaLang/julia/issues/24980
[#28850]: https://github.com/JuliaLang/julia/issues/28850
[#29777]: https://github.com/JuliaLang/julia/issues/29777
[#29790]: https://github.com/JuliaLang/julia/issues/29790
[#29998]: https://github.com/JuliaLang/julia/issues/29998
[#30061]: https://github.com/JuliaLang/julia/issues/30061
Expand All @@ -88,6 +90,7 @@ Deprecated or removed
[#30349]: https://github.com/JuliaLang/julia/issues/30349
[#30372]: https://github.com/JuliaLang/julia/issues/30372
[#30382]: https://github.com/JuliaLang/julia/issues/30382
[#30577]: https://github.com/JuliaLang/julia/issues/30577
[#30583]: https://github.com/JuliaLang/julia/issues/30583
[#30584]: https://github.com/JuliaLang/julia/issues/30584
[#30593]: https://github.com/JuliaLang/julia/issues/30593
Expand All @@ -96,3 +99,4 @@ Deprecated or removed
[#30712]: https://github.com/JuliaLang/julia/issues/30712
[#30724]: https://github.com/JuliaLang/julia/issues/30724
[#30915]: https://github.com/JuliaLang/julia/issues/30915
[#30919]: https://github.com/JuliaLang/julia/issues/30919
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 28c3dd0

Please sign in to comment.