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 14, 2019
1 parent f666f7b commit 44676fc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 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
1 change: 0 additions & 1 deletion base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,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 44676fc

Please sign in to comment.