Skip to content

Commit

Permalink
Deprecate zero and one for Ptr{T}
Browse files Browse the repository at this point in the history
They doesn't fulfill the documentation for zero and one about additive
and multiplicative identity.

See discussion in
JuliaLang#6183 (comment)
  • Loading branch information
ivarne committed Nov 5, 2014
1 parent cdcdc7a commit 47348ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 5 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,8 @@ end

export String
const String = AbstractString

@deprecate zero{T}(::Type{Ptr{T}}) Ptr{T}(0)
@deprecate zero{T}(x::Ptr{T}) Ptr{T}(0)
@deprecate one{T}(::Type{Ptr{T}}) Ptr{T}(1)
@deprecate one{T}(x::Ptr{T}) Ptr{T}(1)
5 changes: 0 additions & 5 deletions base/pointer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,3 @@ eltype{T}(::Ptr{T}) = T
+(x::Ptr, y::Integer) = oftype(x, uint(uint(x) + y))
-(x::Ptr, y::Integer) = oftype(x, uint(uint(x) - y))
+(x::Integer, y::Ptr) = y + x

zero{T}(::Type{Ptr{T}}) = convert(Ptr{T}, 0)
zero{T}(x::Ptr{T}) = convert(Ptr{T}, 0)
one{T}(::Type{Ptr{T}}) = convert(Ptr{T}, 1)
one{T}(x::Ptr{T}) = convert(Ptr{T}, 1)

0 comments on commit 47348ec

Please sign in to comment.